/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    cn-hangzhou = 'cloudcode.cn-hangzhou.aliyuncs.com',
    cn-shanghai = 'cloudcode.cn-shanghai.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('unimkt', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ChangeMediaStatusRequest {
  accessStatus?: string(name='AccessStatus'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  mediaStatus?: string(name='MediaStatus'),
  message?: string(name='Message'),
  messageKey?: string(name='MessageKey'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ChangeMediaStatusResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    accessStatus?: string(name='AccessStatus'),
    accessWay?: string(name='AccessWay'),
    config?: string(name='Config'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    firstScene?: string(name='FirstScene'),
    keyWords?: string(name='KeyWords'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    mediaStatus?: string(name='MediaStatus'),
    mediaType?: string(name='MediaType'),
    modifyTime?: long(name='ModifyTime'),
    os?: string(name='Os'),
    secondScene?: string(name='SecondScene'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ChangeMediaStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ChangeMediaStatusResponseBody(name='body'),
}

async function changeMediaStatusWithOptions(request: ChangeMediaStatusRequest, runtime: Util.RuntimeOptions): ChangeMediaStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.accessStatus)) {
    body['AccessStatus'] = request.accessStatus;
  }
  if (!Util.isUnset(request.mediaId)) {
    body['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.mediaStatus)) {
    body['MediaStatus'] = request.mediaStatus;
  }
  if (!Util.isUnset(request.message)) {
    body['Message'] = request.message;
  }
  if (!Util.isUnset(request.messageKey)) {
    body['MessageKey'] = request.messageKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ChangeMediaStatus',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function changeMediaStatus(request: ChangeMediaStatusRequest): ChangeMediaStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeMediaStatusWithOptions(request, runtime);
}

model ChangeSlotStatusRequest {
  adSlotCorporateStatus?: string(name='AdSlotCorporateStatus'),
  adSlotId?: string(name='AdSlotId'),
  adSlotStatus?: string(name='AdSlotStatus'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  message?: string(name='Message'),
  messageKey?: string(name='MessageKey'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ChangeSlotStatusResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    adSlotCorporateStatus?: string(name='AdSlotCorporateStatus'),
    adSlotId?: string(name='AdSlotId'),
    adSlotName?: string(name='AdSlotName'),
    adSlotStatus?: string(name='AdSlotStatus'),
    adSlotTemplateId?: string(name='AdSlotTemplateId'),
    adSlotType?: string(name='AdSlotType'),
    blockingRule?: string(name='BlockingRule'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    inspireScene?: string(name='InspireScene'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    modifyTime?: long(name='ModifyTime'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ChangeSlotStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ChangeSlotStatusResponseBody(name='body'),
}

async function changeSlotStatusWithOptions(request: ChangeSlotStatusRequest, runtime: Util.RuntimeOptions): ChangeSlotStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adSlotCorporateStatus)) {
    body['AdSlotCorporateStatus'] = request.adSlotCorporateStatus;
  }
  if (!Util.isUnset(request.adSlotId)) {
    body['AdSlotId'] = request.adSlotId;
  }
  if (!Util.isUnset(request.adSlotStatus)) {
    body['AdSlotStatus'] = request.adSlotStatus;
  }
  if (!Util.isUnset(request.message)) {
    body['Message'] = request.message;
  }
  if (!Util.isUnset(request.messageKey)) {
    body['MessageKey'] = request.messageKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ChangeSlotStatus',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function changeSlotStatus(request: ChangeSlotStatusRequest): ChangeSlotStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeSlotStatusWithOptions(request, runtime);
}

model ChangeTenantStatusRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  message?: string(name='Message'),
  messageKey?: string(name='MessageKey'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  status?: string(name='Status'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ChangeTenantStatusResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    business?: string(name='Business'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    settleInfo?: string(name='SettleInfo'),
    status?: string(name='Status'),
    tenantDescription?: string(name='TenantDescription'),
    tenantId?: string(name='TenantId'),
    tenantName?: string(name='TenantName'),
    userName?: string(name='UserName'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ChangeTenantStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ChangeTenantStatusResponseBody(name='body'),
}

async function changeTenantStatusWithOptions(request: ChangeTenantStatusRequest, runtime: Util.RuntimeOptions): ChangeTenantStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.message)) {
    body['Message'] = request.message;
  }
  if (!Util.isUnset(request.messageKey)) {
    body['MessageKey'] = request.messageKey;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ChangeTenantStatus',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function changeTenantStatus(request: ChangeTenantStatusRequest): ChangeTenantStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeTenantStatusWithOptions(request, runtime);
}

model ChangeTenantUserStatusRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  message?: string(name='Message'),
  messageKey?: string(name='MessageKey'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  status?: string(name='Status'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ChangeTenantUserStatusResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    business?: string(name='Business'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    originSite?: string(name='OriginSite'),
    originSiteUserId?: string(name='OriginSiteUserId'),
    originSiteUserName?: string(name='OriginSiteUserName'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    tenantName?: string(name='TenantName'),
    userId?: string(name='UserId'),
    userName?: string(name='UserName'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ChangeTenantUserStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ChangeTenantUserStatusResponseBody(name='body'),
}

async function changeTenantUserStatusWithOptions(request: ChangeTenantUserStatusRequest, runtime: Util.RuntimeOptions): ChangeTenantUserStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.message)) {
    body['Message'] = request.message;
  }
  if (!Util.isUnset(request.messageKey)) {
    body['MessageKey'] = request.messageKey;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ChangeTenantUserStatus',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function changeTenantUserStatus(request: ChangeTenantUserStatusRequest): ChangeTenantUserStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeTenantUserStatusWithOptions(request, runtime);
}

model ChargeLaunchRequest {
  alipayOpenId?: string(name='AlipayOpenId'),
  channelId?: string(name='ChannelId'),
  extra?: string(name='Extra'),
  outerCode?: string(name='OuterCode'),
}

model ChargeLaunchResponseBody = {
  errorCode?: int32(name='ErrorCode'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId'),
  result?: string(name='Result'),
  success?: boolean(name='Success'),
}

model ChargeLaunchResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ChargeLaunchResponseBody(name='body'),
}

async function chargeLaunchWithOptions(request: ChargeLaunchRequest, runtime: Util.RuntimeOptions): ChargeLaunchResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alipayOpenId)) {
    query['AlipayOpenId'] = request.alipayOpenId;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.extra)) {
    query['Extra'] = request.extra;
  }
  if (!Util.isUnset(request.outerCode)) {
    query['OuterCode'] = request.outerCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ChargeLaunch',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function chargeLaunch(request: ChargeLaunchRequest): ChargeLaunchResponse {
  var runtime = new Util.RuntimeOptions{};
  return chargeLaunchWithOptions(request, runtime);
}

model CheckDeviceRequest {
  channelId?: string(name='ChannelId'),
  deviceSn?: string(name='DeviceSn'),
}

model CheckDeviceResponseBody = {
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  plans?: {
    planDto?: [ 
    {
      endTime?: string(name='EndTime'),
      id?: long(name='Id'),
      name?: string(name='Name'),
      startTime?: string(name='StartTime'),
    }
  ](name='PlanDto')
  }(name='Plans'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model CheckDeviceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckDeviceResponseBody(name='body'),
}

async function checkDeviceWithOptions(request: CheckDeviceRequest, runtime: Util.RuntimeOptions): CheckDeviceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.deviceSn)) {
    body['DeviceSn'] = request.deviceSn;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CheckDevice',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkDevice(request: CheckDeviceRequest): CheckDeviceResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkDeviceWithOptions(request, runtime);
}

model CheckReceivingDetailRequest {
  channelId?: string(name='ChannelId'),
  deviceCode?: string(name='DeviceCode'),
  v?: string(name='V'),
}

model CheckReceivingDetailResponseBody = {
  errorCode?: string(name='ErrorCode'),
  hasPromotion?: boolean(name='HasPromotion'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
  tradeOrderId?: string(name='TradeOrderId'),
  unionAmount?: string(name='UnionAmount'),
}

model CheckReceivingDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckReceivingDetailResponseBody(name='body'),
}

async function checkReceivingDetailWithOptions(request: CheckReceivingDetailRequest, runtime: Util.RuntimeOptions): CheckReceivingDetailResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.deviceCode)) {
    body['DeviceCode'] = request.deviceCode;
  }
  if (!Util.isUnset(request.v)) {
    body['V'] = request.v;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CheckReceivingDetail',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkReceivingDetail(request: CheckReceivingDetailRequest): CheckReceivingDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkReceivingDetailWithOptions(request, runtime);
}

model CheckTenantBizRequest {
  adSlotId?: string(name='AdSlotId'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CheckTenantBizResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    canAccessAdSlot?: boolean(name='CanAccessAdSlot'),
    canAccessMedia?: boolean(name='CanAccessMedia'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CheckTenantBizResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckTenantBizResponseBody(name='body'),
}

async function checkTenantBizWithOptions(request: CheckTenantBizRequest, runtime: Util.RuntimeOptions): CheckTenantBizResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adSlotId)) {
    query['AdSlotId'] = request.adSlotId;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.mediaId)) {
    query['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckTenantBiz',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkTenantBiz(request: CheckTenantBizRequest): CheckTenantBizResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkTenantBizWithOptions(request, runtime);
}

model CheckUserFinishAdRequest {
  adid?: long(name='Adid'),
  clicklink?: string(name='Clicklink'),
  id?: string(name='Id'),
  mediaid?: string(name='Mediaid'),
  tagid?: string(name='Tagid'),
  uid?: string(name='Uid'),
}

model CheckUserFinishAdResponseBody = {
  errorCode?: string(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  ext?: map[string]string(name='Ext'),
  header?: {
    costTime?: long(name='CostTime'),
    rpcId?: string(name='RpcId'),
    traceId?: string(name='TraceId'),
    version?: string(name='Version'),
  }(name='Header'),
  requestId?: string(name='RequestId'),
  result?: {
    commission?: string(name='Commission'),
    marketingType?: string(name='MarketingType'),
    objective?: string(name='Objective'),
    success?: boolean(name='Success'),
  }(name='Result'),
  success?: boolean(name='Success'),
}

model CheckUserFinishAdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckUserFinishAdResponseBody(name='body'),
}

async function checkUserFinishAdWithOptions(request: CheckUserFinishAdRequest, runtime: Util.RuntimeOptions): CheckUserFinishAdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adid)) {
    query['Adid'] = request.adid;
  }
  if (!Util.isUnset(request.clicklink)) {
    query['Clicklink'] = request.clicklink;
  }
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.mediaid)) {
    query['Mediaid'] = request.mediaid;
  }
  if (!Util.isUnset(request.tagid)) {
    query['Tagid'] = request.tagid;
  }
  if (!Util.isUnset(request.uid)) {
    query['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckUserFinishAd',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkUserFinishAd(request: CheckUserFinishAdRequest): CheckUserFinishAdResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkUserFinishAdWithOptions(request, runtime);
}

model CountUserRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  sspUser?: map[string]any(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CountUserShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  sspUserShrink?: string(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CountUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: int32(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CountUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CountUserResponseBody(name='body'),
}

async function countUserWithOptions(tmpReq: CountUserRequest, runtime: Util.RuntimeOptions): CountUserResponse {
  Util.validateModel(tmpReq);
  var request = new CountUserShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.sspUser)) {
    request.sspUserShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sspUser, 'SspUser', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.sspUserShrink)) {
    body['SspUser'] = request.sspUserShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CountUser',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function countUser(request: CountUserRequest): CountUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return countUserWithOptions(request, runtime);
}

model CreateCalculationRequest {
  clientToken?: string(name='ClientToken'),
  cloudCodeUserId?: string(name='CloudCodeUserId'),
  queryString?: string(name='QueryString'),
}

model CreateCalculationResponseBody = {
  errorCode?: int32(name='ErrorCode'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId'),
  result?: string(name='Result'),
  success?: boolean(name='Success'),
}

model CreateCalculationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateCalculationResponseBody(name='body'),
}

async function createCalculationWithOptions(request: CreateCalculationRequest, runtime: Util.RuntimeOptions): CreateCalculationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.cloudCodeUserId)) {
    query['CloudCodeUserId'] = request.cloudCodeUserId;
  }
  if (!Util.isUnset(request.queryString)) {
    query['QueryString'] = request.queryString;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCalculation',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createCalculation(request: CreateCalculationRequest): CreateCalculationResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCalculationWithOptions(request, runtime);
}

model CreateFlowRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  flow?: map[string]any(name='Flow'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateFlowShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  flowShrink?: string(name='Flow'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateFlowResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    applyUserId?: string(name='ApplyUserId'),
    approveTime?: long(name='ApproveTime'),
    approveUserId?: string(name='ApproveUserId'),
    businessKey?: string(name='BusinessKey'),
    childStatus?: string(name='ChildStatus'),
    extInfo?: string(name='ExtInfo'),
    flowId?: string(name='FlowId'),
    gmtCreateTime?: long(name='GmtCreateTime'),
    gmtModifiedTime?: long(name='GmtModifiedTime'),
    newData?: string(name='NewData'),
    oldData?: string(name='OldData'),
    reasonType?: string(name='ReasonType'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    type?: string(name='Type'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateFlowResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateFlowResponseBody(name='body'),
}

async function createFlowWithOptions(tmpReq: CreateFlowRequest, runtime: Util.RuntimeOptions): CreateFlowResponse {
  Util.validateModel(tmpReq);
  var request = new CreateFlowShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.flow)) {
    request.flowShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.flow, 'Flow', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.flowShrink)) {
    body['Flow'] = request.flowShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateFlow',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createFlow(request: CreateFlowRequest): CreateFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFlowWithOptions(request, runtime);
}

model CreateMediaRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  media?: map[string]any(name='Media'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateMediaShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  mediaShrink?: string(name='Media'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateMediaResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    accessStatus?: string(name='AccessStatus'),
    accessWay?: string(name='AccessWay'),
    config?: string(name='Config'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    firstScene?: string(name='FirstScene'),
    keyWords?: string(name='KeyWords'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    mediaStatus?: string(name='MediaStatus'),
    mediaType?: string(name='MediaType'),
    modifyTime?: long(name='ModifyTime'),
    os?: string(name='Os'),
    secondScene?: string(name='SecondScene'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateMediaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateMediaResponseBody(name='body'),
}

async function createMediaWithOptions(tmpReq: CreateMediaRequest, runtime: Util.RuntimeOptions): CreateMediaResponse {
  Util.validateModel(tmpReq);
  var request = new CreateMediaShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.media)) {
    request.mediaShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.media, 'Media', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.mediaShrink)) {
    body['Media'] = request.mediaShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateMedia',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createMedia(request: CreateMediaRequest): CreateMediaResponse {
  var runtime = new Util.RuntimeOptions{};
  return createMediaWithOptions(request, runtime);
}

model CreateProxyBrandUserRequest {
  brandUserNick?: string(name='BrandUserNick'),
  channelId?: string(name='ChannelId'),
  clientToken?: string(name='ClientToken'),
  company?: string(name='Company'),
  contactName?: string(name='ContactName'),
  contactPhone?: string(name='ContactPhone'),
  industry?: string(name='Industry'),
  proxyUserId?: long(name='ProxyUserId'),
}

model CreateProxyBrandUserResponseBody = {
  code?: int32(name='Code'),
  data?: boolean(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateProxyBrandUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateProxyBrandUserResponseBody(name='body'),
}

async function createProxyBrandUserWithOptions(request: CreateProxyBrandUserRequest, runtime: Util.RuntimeOptions): CreateProxyBrandUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.brandUserNick)) {
    query['BrandUserNick'] = request.brandUserNick;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.company)) {
    query['Company'] = request.company;
  }
  if (!Util.isUnset(request.contactName)) {
    query['ContactName'] = request.contactName;
  }
  if (!Util.isUnset(request.contactPhone)) {
    query['ContactPhone'] = request.contactPhone;
  }
  if (!Util.isUnset(request.industry)) {
    query['Industry'] = request.industry;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateProxyBrandUser',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createProxyBrandUser(request: CreateProxyBrandUserRequest): CreateProxyBrandUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return createProxyBrandUserWithOptions(request, runtime);
}

model CreateRuleRequest {
  adRule?: map[string]any(name='AdRule'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateRuleShrinkRequest {
  adRuleShrink?: string(name='AdRule'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateRuleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    accessStatus?: string(name='AccessStatus'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    relatedAdSlots?: string(name='RelatedAdSlots'),
    ruleConfig?: string(name='RuleConfig'),
    ruleId?: string(name='RuleId'),
    ruleName?: string(name='RuleName'),
    ruleRId?: string(name='RuleRId'),
    ruleType?: string(name='RuleType'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateRuleResponseBody(name='body'),
}

async function createRuleWithOptions(tmpReq: CreateRuleRequest, runtime: Util.RuntimeOptions): CreateRuleResponse {
  Util.validateModel(tmpReq);
  var request = new CreateRuleShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.adRule)) {
    request.adRuleShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.adRule, 'AdRule', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adRuleShrink)) {
    body['AdRule'] = request.adRuleShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateRule',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createRule(request: CreateRuleRequest): CreateRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createRuleWithOptions(request, runtime);
}

model CreateSlotRequest {
  adSlot?: map[string]any(name='AdSlot'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateSlotShrinkRequest {
  adSlotShrink?: string(name='AdSlot'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateSlotResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    adSlotCorporateStatus?: string(name='AdSlotCorporateStatus'),
    adSlotId?: string(name='AdSlotId'),
    adSlotName?: string(name='AdSlotName'),
    adSlotStatus?: string(name='AdSlotStatus'),
    adSlotTemplateId?: string(name='AdSlotTemplateId'),
    adSlotType?: string(name='AdSlotType'),
    blockingRule?: string(name='BlockingRule'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    inspireScene?: string(name='InspireScene'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    modifyTime?: long(name='ModifyTime'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateSlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSlotResponseBody(name='body'),
}

async function createSlotWithOptions(tmpReq: CreateSlotRequest, runtime: Util.RuntimeOptions): CreateSlotResponse {
  Util.validateModel(tmpReq);
  var request = new CreateSlotShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.adSlot)) {
    request.adSlotShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.adSlot, 'AdSlot', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adSlotShrink)) {
    body['AdSlot'] = request.adSlotShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateSlot',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSlot(request: CreateSlotRequest): CreateSlotResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSlotWithOptions(request, runtime);
}

model CreateTenantRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenant?: map[string]any(name='Tenant'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateTenantShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantShrink?: string(name='Tenant'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateTenantResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    business?: string(name='Business'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    settleInfo?: string(name='SettleInfo'),
    status?: string(name='Status'),
    tenantDescription?: string(name='TenantDescription'),
    tenantId?: string(name='TenantId'),
    tenantName?: string(name='TenantName'),
    userName?: string(name='UserName'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateTenantResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTenantResponseBody(name='body'),
}

async function createTenantWithOptions(tmpReq: CreateTenantRequest, runtime: Util.RuntimeOptions): CreateTenantResponse {
  Util.validateModel(tmpReq);
  var request = new CreateTenantShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tenant)) {
    request.tenantShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tenant, 'Tenant', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.tenantShrink)) {
    body['Tenant'] = request.tenantShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTenant',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTenant(request: CreateTenantRequest): CreateTenantResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTenantWithOptions(request, runtime);
}

model CreateTenantUserRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  tenantUser?: map[string]any(name='TenantUser'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateTenantUserShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  tenantUserShrink?: string(name='TenantUser'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateTenantUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    business?: string(name='Business'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    originSite?: string(name='OriginSite'),
    originSiteUserId?: string(name='OriginSiteUserId'),
    originSiteUserName?: string(name='OriginSiteUserName'),
    settleInfo?: string(name='SettleInfo'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    tenantName?: string(name='TenantName'),
    userId?: string(name='UserId'),
    userName?: string(name='UserName'),
    version?: string(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateTenantUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTenantUserResponseBody(name='body'),
}

async function createTenantUserWithOptions(tmpReq: CreateTenantUserRequest, runtime: Util.RuntimeOptions): CreateTenantUserResponse {
  Util.validateModel(tmpReq);
  var request = new CreateTenantUserShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tenantUser)) {
    request.tenantUserShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tenantUser, 'TenantUser', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.tenantUserShrink)) {
    body['TenantUser'] = request.tenantUserShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTenantUser',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTenantUser(request: CreateTenantUserRequest): CreateTenantUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTenantUserWithOptions(request, runtime);
}

model CreateUnionTaskRequest {
  anchorId?: string(name='AnchorId'),
  brandUserId?: long(name='BrandUserId'),
  brandUserNick?: string(name='BrandUserNick'),
  channel?: string(name='Channel'),
  channelId?: string(name='ChannelId'),
  chargePloy?: long(name='ChargePloy'),
  chargeType?: long(name='ChargeType'),
  clientToken?: string(name='ClientToken'),
  contentId?: long(name='ContentId'),
  contentUrl?: string(name='ContentUrl'),
  customCreativeType?: string(name='CustomCreativeType'),
  endTime?: string(name='EndTime'),
  industryLabelBagId?: int32(name='IndustryLabelBagId'),
  mediaIdBlackList?: [ string ](name='MediaIdBlackList'),
  mediaIdWhiteList?: [ string ](name='MediaIdWhiteList'),
  mediaIndustry?: string(name='MediaIndustry'),
  name?: string(name='Name'),
  optimizationSwitch?: long(name='OptimizationSwitch'),
  proxyUserId?: long(name='ProxyUserId'),
  quota?: long(name='Quota'),
  quotaDay?: long(name='QuotaDay'),
  startTime?: string(name='StartTime'),
  taskBizType?: string(name='TaskBizType'),
  taskRuleType?: string(name='TaskRuleType'),
  taskType?: string(name='TaskType'),
}

model CreateUnionTaskShrinkRequest {
  anchorId?: string(name='AnchorId'),
  brandUserId?: long(name='BrandUserId'),
  brandUserNick?: string(name='BrandUserNick'),
  channel?: string(name='Channel'),
  channelId?: string(name='ChannelId'),
  chargePloy?: long(name='ChargePloy'),
  chargeType?: long(name='ChargeType'),
  clientToken?: string(name='ClientToken'),
  contentId?: long(name='ContentId'),
  contentUrl?: string(name='ContentUrl'),
  customCreativeType?: string(name='CustomCreativeType'),
  endTime?: string(name='EndTime'),
  industryLabelBagId?: int32(name='IndustryLabelBagId'),
  mediaIdBlackListShrink?: string(name='MediaIdBlackList'),
  mediaIdWhiteListShrink?: string(name='MediaIdWhiteList'),
  mediaIndustry?: string(name='MediaIndustry'),
  name?: string(name='Name'),
  optimizationSwitch?: long(name='OptimizationSwitch'),
  proxyUserId?: long(name='ProxyUserId'),
  quota?: long(name='Quota'),
  quotaDay?: long(name='QuotaDay'),
  startTime?: string(name='StartTime'),
  taskBizType?: string(name='TaskBizType'),
  taskRuleType?: string(name='TaskRuleType'),
  taskType?: string(name='TaskType'),
}

model CreateUnionTaskResponseBody = {
  code?: int32(name='Code'),
  data?: long(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateUnionTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateUnionTaskResponseBody(name='body'),
}

async function createUnionTaskWithOptions(tmpReq: CreateUnionTaskRequest, runtime: Util.RuntimeOptions): CreateUnionTaskResponse {
  Util.validateModel(tmpReq);
  var request = new CreateUnionTaskShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.mediaIdBlackList)) {
    request.mediaIdBlackListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.mediaIdBlackList, 'MediaIdBlackList', 'json');
  }
  if (!Util.isUnset(tmpReq.mediaIdWhiteList)) {
    request.mediaIdWhiteListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.mediaIdWhiteList, 'MediaIdWhiteList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.anchorId)) {
    query['AnchorId'] = request.anchorId;
  }
  if (!Util.isUnset(request.brandUserId)) {
    query['BrandUserId'] = request.brandUserId;
  }
  if (!Util.isUnset(request.brandUserNick)) {
    query['BrandUserNick'] = request.brandUserNick;
  }
  if (!Util.isUnset(request.channel)) {
    query['Channel'] = request.channel;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.chargePloy)) {
    query['ChargePloy'] = request.chargePloy;
  }
  if (!Util.isUnset(request.chargeType)) {
    query['ChargeType'] = request.chargeType;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.contentId)) {
    query['ContentId'] = request.contentId;
  }
  if (!Util.isUnset(request.contentUrl)) {
    query['ContentUrl'] = request.contentUrl;
  }
  if (!Util.isUnset(request.customCreativeType)) {
    query['CustomCreativeType'] = request.customCreativeType;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.industryLabelBagId)) {
    query['IndustryLabelBagId'] = request.industryLabelBagId;
  }
  if (!Util.isUnset(request.mediaIdBlackListShrink)) {
    query['MediaIdBlackList'] = request.mediaIdBlackListShrink;
  }
  if (!Util.isUnset(request.mediaIdWhiteListShrink)) {
    query['MediaIdWhiteList'] = request.mediaIdWhiteListShrink;
  }
  if (!Util.isUnset(request.mediaIndustry)) {
    query['MediaIndustry'] = request.mediaIndustry;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.optimizationSwitch)) {
    query['OptimizationSwitch'] = request.optimizationSwitch;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.quota)) {
    query['Quota'] = request.quota;
  }
  if (!Util.isUnset(request.quotaDay)) {
    query['QuotaDay'] = request.quotaDay;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.taskBizType)) {
    query['TaskBizType'] = request.taskBizType;
  }
  if (!Util.isUnset(request.taskRuleType)) {
    query['TaskRuleType'] = request.taskRuleType;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateUnionTask',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createUnionTask(request: CreateUnionTaskRequest): CreateUnionTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return createUnionTaskWithOptions(request, runtime);
}

model CreateUserRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  sspUser?: map[string]any(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateUserShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  sspUserShrink?: string(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreateUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    email?: string(name='Email'),
    gmtCreateTime?: long(name='GmtCreateTime'),
    gmtModifiedTime?: long(name='GmtModifiedTime'),
    isDeleteTag?: string(name='IsDeleteTag'),
    mobilePhone?: string(name='MobilePhone'),
    roleCode?: string(name='RoleCode'),
    sspUserId?: string(name='SspUserId'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    tenantUserId?: string(name='TenantUserId'),
    userName?: string(name='UserName'),
    yunPersonsId?: string(name='YunPersonsId'),
    yunUid?: string(name='YunUid'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateUserResponseBody(name='body'),
}

async function createUserWithOptions(tmpReq: CreateUserRequest, runtime: Util.RuntimeOptions): CreateUserResponse {
  Util.validateModel(tmpReq);
  var request = new CreateUserShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.sspUser)) {
    request.sspUserShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sspUser, 'SspUser', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.sspUserShrink)) {
    body['SspUser'] = request.sspUserShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateUser',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createUser(request: CreateUserRequest): CreateUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return createUserWithOptions(request, runtime);
}

model CreatesSlotTemplateRequest {
  adSlotTemplate?: map[string]any(name='AdSlotTemplate'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreatesSlotTemplateShrinkRequest {
  adSlotTemplateShrink?: string(name='AdSlotTemplate'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model CreatesSlotTemplateResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    adSlotTemplateDescription?: string(name='AdSlotTemplateDescription'),
    adSlotTemplateId?: string(name='AdSlotTemplateId'),
    adSlotTemplateName?: string(name='AdSlotTemplateName'),
    adSlotTemplatePic?: string(name='AdSlotTemplatePic'),
    adSlotTemplatePreview?: string(name='AdSlotTemplatePreview'),
    adSlotTemplateTitle?: string(name='AdSlotTemplateTitle'),
    adSlotType?: string(name='AdSlotType'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    templateConfig?: string(name='TemplateConfig'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreatesSlotTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreatesSlotTemplateResponseBody(name='body'),
}

async function createsSlotTemplateWithOptions(tmpReq: CreatesSlotTemplateRequest, runtime: Util.RuntimeOptions): CreatesSlotTemplateResponse {
  Util.validateModel(tmpReq);
  var request = new CreatesSlotTemplateShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.adSlotTemplate)) {
    request.adSlotTemplateShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.adSlotTemplate, 'AdSlotTemplate', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adSlotTemplateShrink)) {
    body['AdSlotTemplate'] = request.adSlotTemplateShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreatesSlotTemplate',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createsSlotTemplate(request: CreatesSlotTemplateRequest): CreatesSlotTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return createsSlotTemplateWithOptions(request, runtime);
}

model DeleteRuleRequest {
  adRule?: map[string]any(name='AdRule'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  message?: string(name='Message'),
  messageKey?: string(name='MessageKey'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  ruleId?: string(name='RuleId'),
  status?: string(name='Status'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model DeleteRuleShrinkRequest {
  adRuleShrink?: string(name='AdRule'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  message?: string(name='Message'),
  messageKey?: string(name='MessageKey'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  ruleId?: string(name='RuleId'),
  status?: string(name='Status'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model DeleteRuleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    relatedAdSlots?: string(name='RelatedAdSlots'),
    ruleConfig?: string(name='RuleConfig'),
    ruleId?: string(name='RuleId'),
    ruleName?: string(name='RuleName'),
    ruleRId?: string(name='RuleRId'),
    ruleType?: string(name='RuleType'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteRuleResponseBody(name='body'),
}

async function deleteRuleWithOptions(tmpReq: DeleteRuleRequest, runtime: Util.RuntimeOptions): DeleteRuleResponse {
  Util.validateModel(tmpReq);
  var request = new DeleteRuleShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.adRule)) {
    request.adRuleShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.adRule, 'AdRule', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.message)) {
    query['Message'] = request.message;
  }
  if (!Util.isUnset(request.messageKey)) {
    query['MessageKey'] = request.messageKey;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adRuleShrink)) {
    body['AdRule'] = request.adRuleShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteRule',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteRule(request: DeleteRuleRequest): DeleteRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteRuleWithOptions(request, runtime);
}

model DeleteUnionBrandRequest {
  brandMainId?: long(name='BrandMainId', example='167332546421354'),
  channelId?: string(name='ChannelId', example='QD-WXXJ-403576'),
  proxyUserId?: long(name='ProxyUserId', example='167332546421354'),
}

model DeleteUnionBrandResponseBody = {
  code?: string(name='Code', example='0'),
  data?: boolean(name='Data', example='True'),
  errorMsg?: string(name='ErrorMsg', example='error check permissions'),
  requestId?: string(name='RequestId', description='Id of the request', example='6CBD8D0F-D84A-5545-817C-16C7430FD612'),
  success?: string(name='Success', example='True'),
}

model DeleteUnionBrandResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteUnionBrandResponseBody(name='body'),
}

async function deleteUnionBrandWithOptions(request: DeleteUnionBrandRequest, runtime: Util.RuntimeOptions): DeleteUnionBrandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.brandMainId)) {
    query['BrandMainId'] = request.brandMainId;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteUnionBrand',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteUnionBrand(request: DeleteUnionBrandRequest): DeleteUnionBrandResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteUnionBrandWithOptions(request, runtime);
}

model DeviceApiAddDeviceRequest {
  channelId?: string(name='ChannelId'),
  city?: string(name='City'),
  deviceModelNumber?: string(name='DeviceModelNumber'),
  deviceName?: string(name='DeviceName'),
  deviceType?: string(name='DeviceType'),
  district?: string(name='District'),
  extraMap?: map[string]any(name='ExtraMap'),
  firstScene?: string(name='FirstScene'),
  floor?: string(name='Floor'),
  locationName?: string(name='LocationName'),
  mediaId?: string(name='MediaId'),
  outerCode?: string(name='OuterCode'),
  province?: string(name='Province'),
  secondScene?: string(name='SecondScene'),
}

model DeviceApiAddDeviceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: string(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeviceApiAddDeviceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeviceApiAddDeviceResponseBody(name='body'),
}

async function deviceApiAddDeviceWithOptions(request: DeviceApiAddDeviceRequest, runtime: Util.RuntimeOptions): DeviceApiAddDeviceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.city)) {
    body['City'] = request.city;
  }
  if (!Util.isUnset(request.deviceModelNumber)) {
    body['DeviceModelNumber'] = request.deviceModelNumber;
  }
  if (!Util.isUnset(request.deviceName)) {
    body['DeviceName'] = request.deviceName;
  }
  if (!Util.isUnset(request.deviceType)) {
    body['DeviceType'] = request.deviceType;
  }
  if (!Util.isUnset(request.district)) {
    body['District'] = request.district;
  }
  if (!Util.isUnset(request.extraMap)) {
    body['ExtraMap'] = request.extraMap;
  }
  if (!Util.isUnset(request.firstScene)) {
    body['FirstScene'] = request.firstScene;
  }
  if (!Util.isUnset(request.floor)) {
    body['Floor'] = request.floor;
  }
  if (!Util.isUnset(request.locationName)) {
    body['LocationName'] = request.locationName;
  }
  if (!Util.isUnset(request.mediaId)) {
    body['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.outerCode)) {
    body['OuterCode'] = request.outerCode;
  }
  if (!Util.isUnset(request.province)) {
    body['Province'] = request.province;
  }
  if (!Util.isUnset(request.secondScene)) {
    body['SecondScene'] = request.secondScene;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeviceApiAddDevice',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deviceApiAddDevice(request: DeviceApiAddDeviceRequest): DeviceApiAddDeviceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deviceApiAddDeviceWithOptions(request, runtime);
}

model EndUnionTaskRequest {
  channelId?: string(name='ChannelId'),
  proxyUserId?: long(name='ProxyUserId'),
  taskId?: long(name='TaskId'),
}

model EndUnionTaskResponseBody = {
  code?: int32(name='Code'),
  data?: boolean(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model EndUnionTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: EndUnionTaskResponseBody(name='body'),
}

async function endUnionTaskWithOptions(request: EndUnionTaskRequest, runtime: Util.RuntimeOptions): EndUnionTaskResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EndUnionTask',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function endUnionTask(request: EndUnionTaskRequest): EndUnionTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return endUnionTaskWithOptions(request, runtime);
}

model GetBizTypeConfigRequest {
  bizType?: string(name='BizType'),
}

model GetBizTypeConfigResponseBody = {
  errorCode?: string(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  ext?: map[string]any(name='Ext'),
  header?: {
    costTime?: long(name='CostTime'),
    rpcId?: string(name='RpcId'),
    traceId?: string(name='TraceId'),
    version?: string(name='Version'),
  }(name='Header'),
  requestId?: string(name='RequestId'),
  result?: {
    accountType?: string(name='AccountType'),
    chargeType?: string(name='ChargeType'),
    code?: string(name='Code'),
    desc?: string(name='Desc'),
    name?: string(name='Name'),
    transactionMode?: string(name='TransactionMode'),
  }(name='Result'),
  success?: boolean(name='Success'),
}

model GetBizTypeConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetBizTypeConfigResponseBody(name='body'),
}

async function getBizTypeConfigWithOptions(request: GetBizTypeConfigRequest, runtime: Util.RuntimeOptions): GetBizTypeConfigResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bizType)) {
    body['BizType'] = request.bizType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetBizTypeConfig',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getBizTypeConfig(request: GetBizTypeConfigRequest): GetBizTypeConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return getBizTypeConfigWithOptions(request, runtime);
}

model GetBizTypeConfigListRequest {
  accountType?: string(name='AccountType', example='ym'),
}

model GetBizTypeConfigListResponseBody = {
  errorCode?: string(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  ext?: map[string]any(name='Ext'),
  header?: {
    costTime?: long(name='CostTime'),
    rpcId?: string(name='RpcId'),
    traceId?: string(name='TraceId'),
    version?: string(name='Version'),
  }(name='Header'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      accountType?: string(name='AccountType'),
      chargeType?: string(name='ChargeType'),
      code?: string(name='Code'),
      desc?: string(name='Desc'),
      name?: string(name='Name'),
      transactionMode?: string(name='TransactionMode'),
    }
  ](name='Result'),
  success?: boolean(name='Success'),
}

model GetBizTypeConfigListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetBizTypeConfigListResponseBody(name='body'),
}

async function getBizTypeConfigListWithOptions(request: GetBizTypeConfigListRequest, runtime: Util.RuntimeOptions): GetBizTypeConfigListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountType)) {
    body['AccountType'] = request.accountType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetBizTypeConfigList',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getBizTypeConfigList(request: GetBizTypeConfigListRequest): GetBizTypeConfigListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getBizTypeConfigListWithOptions(request, runtime);
}

model GetDeliveryTypeConfigRequest {
  deliveryType?: string(name='DeliveryType'),
}

model GetDeliveryTypeConfigResponseBody = {
  errorCode?: string(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  ext?: map[string]any(name='Ext'),
  header?: {
    costTime?: long(name='CostTime'),
    rpcId?: string(name='RpcId'),
    traceId?: string(name='TraceId'),
    version?: string(name='Version'),
  }(name='Header'),
  requestId?: string(name='RequestId'),
  result?: {
    accountType?: string(name='AccountType'),
    code?: string(name='Code'),
    desc?: string(name='Desc'),
    name?: string(name='Name'),
  }(name='Result'),
  success?: boolean(name='Success'),
}

model GetDeliveryTypeConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetDeliveryTypeConfigResponseBody(name='body'),
}

async function getDeliveryTypeConfigWithOptions(request: GetDeliveryTypeConfigRequest, runtime: Util.RuntimeOptions): GetDeliveryTypeConfigResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.deliveryType)) {
    body['DeliveryType'] = request.deliveryType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetDeliveryTypeConfig',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getDeliveryTypeConfig(request: GetDeliveryTypeConfigRequest): GetDeliveryTypeConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDeliveryTypeConfigWithOptions(request, runtime);
}

model GetDeliveryTypeConfigListRequest {
  accountType?: string(name='AccountType'),
}

model GetDeliveryTypeConfigListResponseBody = {
  errorCode?: string(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  ext?: map[string]any(name='Ext'),
  header?: {
    costTime?: long(name='CostTime'),
    rpcId?: string(name='RpcId'),
    traceId?: string(name='TraceId'),
    version?: string(name='Version'),
  }(name='Header'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      accountType?: string(name='AccountType'),
      code?: string(name='Code'),
      desc?: string(name='Desc'),
      name?: string(name='Name'),
    }
  ](name='Result'),
  success?: boolean(name='Success'),
}

model GetDeliveryTypeConfigListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetDeliveryTypeConfigListResponseBody(name='body'),
}

async function getDeliveryTypeConfigListWithOptions(request: GetDeliveryTypeConfigListRequest, runtime: Util.RuntimeOptions): GetDeliveryTypeConfigListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountType)) {
    body['AccountType'] = request.accountType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetDeliveryTypeConfigList',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getDeliveryTypeConfigList(request: GetDeliveryTypeConfigListRequest): GetDeliveryTypeConfigListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDeliveryTypeConfigListWithOptions(request, runtime);
}

model GetMainPartListRequest {
  accountType?: string(name='AccountType', example='yt'),
  mainName?: string(name='MainName', example='模糊查询'),
  mainType?: int32(name='MainType', example='0'),
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  parentMainId?: long(name='ParentMainId', example='11222212212121'),
}

model GetMainPartListResponseBody = {
  code?: long(name='Code'),
  data?: {
    count?: long(name='Count'),
    list?: [ 
      {
        accountNo?: string(name='AccountNo'),
        accountType?: string(name='AccountType'),
        brandUserId?: long(name='BrandUserId'),
        brandUserNick?: string(name='BrandUserNick'),
        mainId?: long(name='MainId'),
        mainName?: string(name='MainName'),
        proxyUserId?: long(name='ProxyUserId'),
      }
    ](name='List'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetMainPartListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetMainPartListResponseBody(name='body'),
}

async function getMainPartListWithOptions(request: GetMainPartListRequest, runtime: Util.RuntimeOptions): GetMainPartListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountType)) {
    query['AccountType'] = request.accountType;
  }
  if (!Util.isUnset(request.mainName)) {
    query['MainName'] = request.mainName;
  }
  if (!Util.isUnset(request.mainType)) {
    query['MainType'] = request.mainType;
  }
  if (!Util.isUnset(request.pageIndex)) {
    query['PageIndex'] = request.pageIndex;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.parentMainId)) {
    query['ParentMainId'] = request.parentMainId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetMainPartList',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getMainPartList(request: GetMainPartListRequest): GetMainPartListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getMainPartListWithOptions(request, runtime);
}

model GetPublishPriceTaskRequest {
  code?: string(name='Code'),
  status?: long(name='Status'),
  type?: string(name='Type'),
}

model GetPublishPriceTaskResponseBody = {
  errorCode?: string(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  ext?: map[string]any(name='Ext'),
  header?: {
    costTime?: long(name='CostTime'),
    rpcId?: string(name='RpcId'),
    traceId?: string(name='TraceId'),
    version?: string(name='Version'),
  }(name='Header'),
  requestId?: string(name='RequestId'),
  result?: {
    accountType?: string(name='AccountType'),
    approver?: string(name='Approver'),
    bpmsProcId?: string(name='BpmsProcId'),
    bpmsProcInsId?: string(name='BpmsProcInsId'),
    catalogPrice?: long(name='CatalogPrice'),
    code?: string(name='Code'),
    deleteFlag?: string(name='DeleteFlag'),
    id?: long(name='Id'),
    name?: string(name='Name'),
    remarks?: string(name='Remarks'),
    taskId?: string(name='TaskId'),
    type?: string(name='Type'),
    version?: string(name='Version'),
  }(name='Result'),
  success?: boolean(name='Success'),
}

model GetPublishPriceTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPublishPriceTaskResponseBody(name='body'),
}

async function getPublishPriceTaskWithOptions(request: GetPublishPriceTaskRequest, runtime: Util.RuntimeOptions): GetPublishPriceTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.code)) {
    body['Code'] = request.code;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetPublishPriceTask',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPublishPriceTask(request: GetPublishPriceTaskRequest): GetPublishPriceTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPublishPriceTaskWithOptions(request, runtime);
}

model GetUnionTaskStatusRequest {
  alipayOpenId?: long(name='AlipayOpenId'),
  channelId?: string(name='ChannelId'),
  sign?: string(name='Sign'),
  taskId?: long(name='TaskId'),
  userId?: long(name='UserId'),
  userNick?: string(name='UserNick'),
}

model GetUnionTaskStatusResponseBody = {
  errorCode?: int32(name='ErrorCode'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId'),
  result?: boolean(name='Result'),
  success?: boolean(name='Success'),
}

model GetUnionTaskStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUnionTaskStatusResponseBody(name='body'),
}

async function getUnionTaskStatusWithOptions(request: GetUnionTaskStatusRequest, runtime: Util.RuntimeOptions): GetUnionTaskStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alipayOpenId)) {
    query['AlipayOpenId'] = request.alipayOpenId;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.sign)) {
    query['Sign'] = request.sign;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userNick)) {
    query['UserNick'] = request.userNick;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetUnionTaskStatus',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUnionTaskStatus(request: GetUnionTaskStatusRequest): GetUnionTaskStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUnionTaskStatusWithOptions(request, runtime);
}

model InnerCallServiceRequest {
  body?: map[string]any(name='body'),
}

model InnerCallServiceResponseBody = {
  code?: boolean(name='Code'),
  errorCode?: string(name='ErrorCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: string(name='Result'),
}

model InnerCallServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: InnerCallServiceResponseBody(name='body'),
}

async function innerCallServiceWithOptions(request: InnerCallServiceRequest, runtime: Util.RuntimeOptions): InnerCallServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.body)) {
    body['body'] = request.body;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'InnerCallService',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function innerCallService(request: InnerCallServiceRequest): InnerCallServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return innerCallServiceWithOptions(request, runtime);
}

model KeepAliveRequest {
  cellId?: string(name='CellId'),
  channelId?: string(name='ChannelId'),
  deviceSn?: string(name='DeviceSn'),
  networkType?: int32(name='NetworkType'),
  tac?: string(name='Tac'),
}

model KeepAliveResponseBody = {
  data?: string(name='Data'),
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model KeepAliveResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: KeepAliveResponseBody(name='body'),
}

async function keepAliveWithOptions(request: KeepAliveRequest, runtime: Util.RuntimeOptions): KeepAliveResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.cellId)) {
    body['CellId'] = request.cellId;
  }
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.deviceSn)) {
    body['DeviceSn'] = request.deviceSn;
  }
  if (!Util.isUnset(request.networkType)) {
    body['NetworkType'] = request.networkType;
  }
  if (!Util.isUnset(request.tac)) {
    body['Tac'] = request.tac;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'KeepAlive',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function keepAlive(request: KeepAliveRequest): KeepAliveResponse {
  var runtime = new Util.RuntimeOptions{};
  return keepAliveWithOptions(request, runtime);
}

model ListFlowRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  listFlow?: map[string]any(name='ListFlow'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListFlowShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  listFlowShrink?: string(name='ListFlow'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListFlowResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      applyUserId?: string(name='ApplyUserId'),
      approveTime?: long(name='ApproveTime'),
      approveUserId?: string(name='ApproveUserId'),
      businessKey?: string(name='BusinessKey'),
      childStatus?: string(name='ChildStatus'),
      extInfo?: string(name='ExtInfo'),
      flowId?: string(name='FlowId'),
      gmtCreateTime?: long(name='GmtCreateTime'),
      gmtModifiedTime?: long(name='GmtModifiedTime'),
      newData?: string(name='NewData'),
      oldData?: string(name='OldData'),
      reasonType?: string(name='ReasonType'),
      status?: string(name='Status'),
      tenantId?: string(name='TenantId'),
      type?: string(name='Type'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListFlowResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListFlowResponseBody(name='body'),
}

async function listFlowWithOptions(tmpReq: ListFlowRequest, runtime: Util.RuntimeOptions): ListFlowResponse {
  Util.validateModel(tmpReq);
  var request = new ListFlowShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.listFlow)) {
    request.listFlowShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.listFlow, 'ListFlow', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.listFlowShrink)) {
    body['ListFlow'] = request.listFlowShrink;
  }
  if (!Util.isUnset(request.pageNumber)) {
    body['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListFlow',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listFlow(request: ListFlowRequest): ListFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFlowWithOptions(request, runtime);
}

model ListMediaRequest {
  accessStatus?: string(name='AccessStatus'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  firstScene?: string(name='FirstScene'),
  mediaName?: map[string]any(name='MediaName'),
  mediaStatus?: string(name='MediaStatus'),
  mediaType?: string(name='MediaType'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  os?: string(name='Os'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  secondScene?: string(name='SecondScene'),
  startCreateTime?: long(name='StartCreateTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListMediaShrinkRequest {
  accessStatus?: string(name='AccessStatus'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  firstScene?: string(name='FirstScene'),
  mediaNameShrink?: string(name='MediaName'),
  mediaStatus?: string(name='MediaStatus'),
  mediaType?: string(name='MediaType'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  os?: string(name='Os'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  secondScene?: string(name='SecondScene'),
  startCreateTime?: long(name='StartCreateTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListMediaResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      accessStatus?: string(name='AccessStatus'),
      accessWay?: string(name='AccessWay'),
      config?: string(name='Config'),
      createTime?: long(name='CreateTime'),
      extInfo?: string(name='ExtInfo'),
      firstScene?: string(name='FirstScene'),
      keyWords?: string(name='KeyWords'),
      mediaId?: string(name='MediaId'),
      mediaName?: string(name='MediaName'),
      mediaStatus?: string(name='MediaStatus'),
      mediaType?: string(name='MediaType'),
      modifyTime?: long(name='ModifyTime'),
      os?: string(name='Os'),
      secondScene?: string(name='SecondScene'),
      tenantId?: string(name='TenantId'),
      version?: long(name='Version'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListMediaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListMediaResponseBody(name='body'),
}

async function listMediaWithOptions(tmpReq: ListMediaRequest, runtime: Util.RuntimeOptions): ListMediaResponse {
  Util.validateModel(tmpReq);
  var request = new ListMediaShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.mediaName)) {
    request.mediaNameShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.mediaName, 'MediaName', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.accessStatus)) {
    query['AccessStatus'] = request.accessStatus;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.endCreateTime)) {
    query['EndCreateTime'] = request.endCreateTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.firstScene)) {
    query['FirstScene'] = request.firstScene;
  }
  if (!Util.isUnset(request.mediaNameShrink)) {
    query['MediaName'] = request.mediaNameShrink;
  }
  if (!Util.isUnset(request.mediaStatus)) {
    query['MediaStatus'] = request.mediaStatus;
  }
  if (!Util.isUnset(request.mediaType)) {
    query['MediaType'] = request.mediaType;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.os)) {
    query['Os'] = request.os;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.secondScene)) {
    query['SecondScene'] = request.secondScene;
  }
  if (!Util.isUnset(request.startCreateTime)) {
    query['StartCreateTime'] = request.startCreateTime;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMedia',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listMedia(request: ListMediaRequest): ListMediaResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMediaWithOptions(request, runtime);
}

model ListMediaNameRequest {
  accessStatus?: string(name='AccessStatus'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  firstScene?: string(name='FirstScene'),
  mediaName?: map[string]any(name='MediaName'),
  mediaStatus?: string(name='MediaStatus'),
  mediaType?: string(name='MediaType'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  os?: string(name='Os'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  secondScene?: string(name='SecondScene'),
  startCreateTime?: long(name='StartCreateTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListMediaNameShrinkRequest {
  accessStatus?: string(name='AccessStatus'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  firstScene?: string(name='FirstScene'),
  mediaNameShrink?: string(name='MediaName'),
  mediaStatus?: string(name='MediaStatus'),
  mediaType?: string(name='MediaType'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  os?: string(name='Os'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  secondScene?: string(name='SecondScene'),
  startCreateTime?: long(name='StartCreateTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListMediaNameResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      mediaId?: string(name='MediaId'),
      mediaName?: string(name='MediaName'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListMediaNameResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListMediaNameResponseBody(name='body'),
}

async function listMediaNameWithOptions(tmpReq: ListMediaNameRequest, runtime: Util.RuntimeOptions): ListMediaNameResponse {
  Util.validateModel(tmpReq);
  var request = new ListMediaNameShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.mediaName)) {
    request.mediaNameShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.mediaName, 'MediaName', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.accessStatus)) {
    query['AccessStatus'] = request.accessStatus;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.endCreateTime)) {
    query['EndCreateTime'] = request.endCreateTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.firstScene)) {
    query['FirstScene'] = request.firstScene;
  }
  if (!Util.isUnset(request.mediaNameShrink)) {
    query['MediaName'] = request.mediaNameShrink;
  }
  if (!Util.isUnset(request.mediaStatus)) {
    query['MediaStatus'] = request.mediaStatus;
  }
  if (!Util.isUnset(request.mediaType)) {
    query['MediaType'] = request.mediaType;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.os)) {
    query['Os'] = request.os;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.secondScene)) {
    query['SecondScene'] = request.secondScene;
  }
  if (!Util.isUnset(request.startCreateTime)) {
    query['StartCreateTime'] = request.startCreateTime;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMediaName',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listMediaName(request: ListMediaNameRequest): ListMediaNameResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMediaNameWithOptions(request, runtime);
}

model ListRuleRequest {
  adSlotId?: string(name='AdSlotId'),
  adSlotName?: string(name='AdSlotName'),
  adSlotType?: string(name='AdSlotType'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  mediaName?: string(name='MediaName'),
  mediaStatus?: string(name='MediaStatus'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  ruleId?: string(name='RuleId'),
  ruleName?: string(name='RuleName'),
  ruleType?: string(name='RuleType'),
  startCreateTime?: long(name='StartCreateTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListRuleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      createTime?: long(name='CreateTime'),
      extInfo?: string(name='ExtInfo'),
      modifyTime?: long(name='ModifyTime'),
      relatedAdSlots?: string(name='RelatedAdSlots'),
      ruleConfig?: string(name='RuleConfig'),
      ruleId?: string(name='RuleId'),
      ruleName?: string(name='RuleName'),
      ruleRId?: string(name='RuleRId'),
      ruleType?: string(name='RuleType'),
      status?: string(name='Status'),
      tenantId?: string(name='TenantId'),
      version?: long(name='Version'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRuleResponseBody(name='body'),
}

async function listRuleWithOptions(request: ListRuleRequest, runtime: Util.RuntimeOptions): ListRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adSlotId)) {
    query['AdSlotId'] = request.adSlotId;
  }
  if (!Util.isUnset(request.adSlotName)) {
    query['AdSlotName'] = request.adSlotName;
  }
  if (!Util.isUnset(request.adSlotType)) {
    query['AdSlotType'] = request.adSlotType;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.endCreateTime)) {
    query['EndCreateTime'] = request.endCreateTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.mediaId)) {
    query['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.mediaName)) {
    query['MediaName'] = request.mediaName;
  }
  if (!Util.isUnset(request.mediaStatus)) {
    query['MediaStatus'] = request.mediaStatus;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!Util.isUnset(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  if (!Util.isUnset(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!Util.isUnset(request.startCreateTime)) {
    query['StartCreateTime'] = request.startCreateTime;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRule',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRule(request: ListRuleRequest): ListRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRuleWithOptions(request, runtime);
}

model ListRuleAreaRequest {
  adSlotId?: string(name='AdSlotId'),
  adSlotType?: string(name='AdSlotType'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  mediaStatus?: string(name='MediaStatus'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  ruleId?: string(name='RuleId'),
  ruleName?: string(name='RuleName'),
  ruleType?: string(name='RuleType'),
  startCreateTime?: long(name='StartCreateTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListRuleAreaResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      adSlotId?: string(name='AdSlotId'),
      adSlotName?: string(name='AdSlotName'),
      mediaId?: string(name='MediaId'),
      mediaName?: string(name='MediaName'),
      recordId?: string(name='RecordId'),
      ruleId?: string(name='RuleId'),
      ruleName?: string(name='RuleName'),
      ruleType?: string(name='RuleType'),
      status?: string(name='Status'),
      tenantId?: string(name='TenantId'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListRuleAreaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRuleAreaResponseBody(name='body'),
}

async function listRuleAreaWithOptions(request: ListRuleAreaRequest, runtime: Util.RuntimeOptions): ListRuleAreaResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adSlotId)) {
    query['AdSlotId'] = request.adSlotId;
  }
  if (!Util.isUnset(request.adSlotType)) {
    query['AdSlotType'] = request.adSlotType;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.endCreateTime)) {
    query['EndCreateTime'] = request.endCreateTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.mediaId)) {
    query['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.mediaStatus)) {
    query['MediaStatus'] = request.mediaStatus;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!Util.isUnset(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  if (!Util.isUnset(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!Util.isUnset(request.startCreateTime)) {
    query['StartCreateTime'] = request.startCreateTime;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRuleArea',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRuleArea(request: ListRuleAreaRequest): ListRuleAreaResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRuleAreaWithOptions(request, runtime);
}

model ListSlotRequest {
  adSlotCorporateStatus?: string(name='AdSlotCorporateStatus'),
  adSlotId?: string(name='AdSlotId'),
  adSlotName?: string(name='AdSlotName'),
  adSlotStatus?: string(name='AdSlotStatus'),
  adSlotType?: string(name='AdSlotType'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  mediaName?: string(name='MediaName'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startCreateTime?: long(name='StartCreateTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListSlotResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      adSlotCorporateStatus?: string(name='AdSlotCorporateStatus'),
      adSlotId?: string(name='AdSlotId'),
      adSlotName?: string(name='AdSlotName'),
      adSlotStatus?: string(name='AdSlotStatus'),
      adSlotTemplateId?: string(name='AdSlotTemplateId'),
      adSlotType?: string(name='AdSlotType'),
      blockingRule?: string(name='BlockingRule'),
      createTime?: long(name='CreateTime'),
      extInfo?: string(name='ExtInfo'),
      inspireScene?: string(name='InspireScene'),
      mediaId?: string(name='MediaId'),
      mediaName?: string(name='MediaName'),
      modifyTime?: long(name='ModifyTime'),
      tenantId?: string(name='TenantId'),
      version?: long(name='Version'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListSlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSlotResponseBody(name='body'),
}

async function listSlotWithOptions(request: ListSlotRequest, runtime: Util.RuntimeOptions): ListSlotResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adSlotCorporateStatus)) {
    query['AdSlotCorporateStatus'] = request.adSlotCorporateStatus;
  }
  if (!Util.isUnset(request.adSlotId)) {
    query['AdSlotId'] = request.adSlotId;
  }
  if (!Util.isUnset(request.adSlotName)) {
    query['AdSlotName'] = request.adSlotName;
  }
  if (!Util.isUnset(request.adSlotStatus)) {
    query['AdSlotStatus'] = request.adSlotStatus;
  }
  if (!Util.isUnset(request.adSlotType)) {
    query['AdSlotType'] = request.adSlotType;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.endCreateTime)) {
    query['EndCreateTime'] = request.endCreateTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.mediaId)) {
    query['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.mediaName)) {
    query['MediaName'] = request.mediaName;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startCreateTime)) {
    query['StartCreateTime'] = request.startCreateTime;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSlot',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSlot(request: ListSlotRequest): ListSlotResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSlotWithOptions(request, runtime);
}

model ListTasksRequest {
  brandUserNick?: string(name='BrandUserNick'),
  currencyType?: long(name='CurrencyType'),
  endTime?: string(name='EndTime'),
  marketingType?: int32(name='MarketingType'),
  pageIndex?: long(name='PageIndex'),
  pageSize?: long(name='PageSize'),
  proxyUserNick?: string(name='ProxyUserNick'),
  startTime?: string(name='StartTime'),
  status?: int32(name='Status'),
  taskId?: long(name='TaskId'),
  taskName?: string(name='TaskName'),
  taskType?: string(name='TaskType'),
}

model ListTasksResponseBody = {
  code?: long(name='Code'),
  data?: {
    bizTypes?: string(name='BizTypes'),
    count?: long(name='Count'),
    list?: [ 
      {
        accountNo?: string(name='AccountNo'),
        accountStatus?: long(name='AccountStatus'),
        actualBankRegisterVO?: {
          inComingPartsNumber?: long(name='InComingPartsNumber'),
          placeOrderNumber?: long(name='PlaceOrderNumber'),
          swipingCardNumber?: long(name='SwipingCardNumber'),
          verificationCardNumber?: long(name='VerificationCardNumber'),
          visaInterviewNumber?: long(name='VisaInterviewNumber'),
        }(name='ActualBankRegisterVO'),
        actualCommonSceneVO?: map[string]string(name='ActualCommonSceneVO'),
        actualConsumeAmount?: long(name='ActualConsumeAmount'),
        actualInfo?: string(name='ActualInfo'),
        brandActualResultNumber?: long(name='BrandActualResultNumber'),
        brandPredictResultNumber?: long(name='BrandPredictResultNumber'),
        brandUserId?: long(name='BrandUserId'),
        brandUserNick?: string(name='BrandUserNick'),
        couponNewActualResultNumber?: long(name='CouponNewActualResultNumber'),
        couponNewPredictResultNumber?: long(name='CouponNewPredictResultNumber'),
        couponNewPriceStep?: long(name='CouponNewPriceStep'),
        couponOldActualResultNumber?: long(name='CouponOldActualResultNumber'),
        couponOldPredictResultNumber?: long(name='CouponOldPredictResultNumber'),
        couponOldPriceStep?: long(name='CouponOldPriceStep'),
        currencyType?: long(name='CurrencyType'),
        endTime?: long(name='EndTime'),
        gmtCreate?: long(name='GmtCreate'),
        gmtModified?: long(name='GmtModified'),
        id?: long(name='Id'),
        loginActualResultNumber?: long(name='LoginActualResultNumber'),
        loginPredictResultNumber?: long(name='LoginPredictResultNumber'),
        mainId?: long(name='MainId'),
        mainType?: long(name='MainType'),
        opNick?: string(name='OpNick'),
        orderActualResultNumber?: long(name='OrderActualResultNumber'),
        orderPredictResultNumber?: long(name='OrderPredictResultNumber'),
        predictBankRegisterVO?: {
          inComingPartsNumber?: long(name='InComingPartsNumber'),
          placeOrderNumber?: long(name='PlaceOrderNumber'),
          swipingCardNumber?: long(name='SwipingCardNumber'),
          verificationCardNumber?: long(name='VerificationCardNumber'),
          visaInterviewNumber?: long(name='VisaInterviewNumber'),
        }(name='PredictBankRegisterVO'),
        predictCommonSceneVO?: map[string]string(name='PredictCommonSceneVO'),
        predictConsumeAmount?: long(name='PredictConsumeAmount'),
        predictInfo?: string(name='PredictInfo'),
        priceType?: long(name='PriceType'),
        proxyUserId?: long(name='ProxyUserId'),
        proxyUserNick?: string(name='ProxyUserNick'),
        scheduleTime?: string(name='ScheduleTime'),
        scheduleType?: long(name='ScheduleType'),
        startTime?: long(name='StartTime'),
        status?: long(name='Status'),
        systemActualConsumeAmount?: long(name='SystemActualConsumeAmount'),
        targetUrl?: string(name='TargetUrl'),
        taskGroupId?: long(name='TaskGroupId'),
        taskId?: long(name='TaskId'),
        taskMarketingType?: long(name='TaskMarketingType'),
        taskName?: string(name='TaskName'),
        taskType?: string(name='TaskType'),
      }
    ](name='List'),
    taskRules?: string(name='TaskRules'),
    type?: int32(name='Type'),
  }(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListTasksResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTasksResponseBody(name='body'),
}

async function listTasksWithOptions(request: ListTasksRequest, runtime: Util.RuntimeOptions): ListTasksResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.brandUserNick)) {
    body['BrandUserNick'] = request.brandUserNick;
  }
  if (!Util.isUnset(request.currencyType)) {
    body['CurrencyType'] = request.currencyType;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.marketingType)) {
    body['MarketingType'] = request.marketingType;
  }
  if (!Util.isUnset(request.pageIndex)) {
    body['PageIndex'] = request.pageIndex;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.proxyUserNick)) {
    body['ProxyUserNick'] = request.proxyUserNick;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.taskName)) {
    body['TaskName'] = request.taskName;
  }
  if (!Util.isUnset(request.taskType)) {
    body['TaskType'] = request.taskType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListTasks',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTasks(request: ListTasksRequest): ListTasksResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTasksWithOptions(request, runtime);
}

model ListTenantRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startCreateTime?: long(name='StartCreateTime'),
  status?: string(name='Status'),
  tenantId?: string(name='TenantId'),
  tenantName?: string(name='TenantName'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListTenantResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      bizId?: string(name='BizId'),
      business?: string(name='Business'),
      createTime?: long(name='CreateTime'),
      extInfo?: string(name='ExtInfo'),
      modifyTime?: long(name='ModifyTime'),
      settleInfo?: string(name='SettleInfo'),
      status?: string(name='Status'),
      tenantDescription?: string(name='TenantDescription'),
      tenantId?: string(name='TenantId'),
      tenantName?: string(name='TenantName'),
      version?: long(name='Version'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListTenantResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTenantResponseBody(name='body'),
}

async function listTenantWithOptions(request: ListTenantRequest, runtime: Util.RuntimeOptions): ListTenantResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.endCreateTime)) {
    query['EndCreateTime'] = request.endCreateTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startCreateTime)) {
    query['StartCreateTime'] = request.startCreateTime;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.tenantName)) {
    query['TenantName'] = request.tenantName;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTenant',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTenant(request: ListTenantRequest): ListTenantResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTenantWithOptions(request, runtime);
}

model ListTenantNameRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  endCreateTime?: long(name='EndCreateTime'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startCreateTime?: long(name='StartCreateTime'),
  status?: string(name='Status'),
  tenantId?: string(name='TenantId'),
  tenantName?: string(name='TenantName'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListTenantNameResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      tenantDescription?: string(name='TenantDescription'),
      tenantId?: string(name='TenantId'),
      tenantName?: string(name='TenantName'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListTenantNameResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTenantNameResponseBody(name='body'),
}

async function listTenantNameWithOptions(request: ListTenantNameRequest, runtime: Util.RuntimeOptions): ListTenantNameResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.endCreateTime)) {
    query['EndCreateTime'] = request.endCreateTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startCreateTime)) {
    query['StartCreateTime'] = request.startCreateTime;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.tenantName)) {
    query['TenantName'] = request.tenantName;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTenantName',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTenantName(request: ListTenantNameRequest): ListTenantNameResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTenantNameWithOptions(request, runtime);
}

model ListUnionMediaIndustryRequest {
  channelId?: string(name='ChannelId'),
  proxyUserId?: long(name='ProxyUserId'),
}

model ListUnionMediaIndustryResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      industryCode?: string(name='IndustryCode'),
      industryName?: string(name='IndustryName'),
      level?: string(name='Level'),
      parentIndustryCode?: string(name='ParentIndustryCode'),
      usedFlag?: boolean(name='UsedFlag'),
    }
  ](name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListUnionMediaIndustryResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListUnionMediaIndustryResponseBody(name='body'),
}

async function listUnionMediaIndustryWithOptions(request: ListUnionMediaIndustryRequest, runtime: Util.RuntimeOptions): ListUnionMediaIndustryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListUnionMediaIndustry',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listUnionMediaIndustry(request: ListUnionMediaIndustryRequest): ListUnionMediaIndustryResponse {
  var runtime = new Util.RuntimeOptions{};
  return listUnionMediaIndustryWithOptions(request, runtime);
}

model ListUserRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  sspUser?: map[string]any(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListUserShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  sspUserShrink?: string(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ListUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      email?: string(name='Email'),
      gmtCreateTime?: long(name='GmtCreateTime'),
      gmtModifiedTime?: long(name='GmtModifiedTime'),
      isDeleteTag?: string(name='IsDeleteTag'),
      mobilePhone?: string(name='MobilePhone'),
      roleCode?: string(name='RoleCode'),
      sspUserId?: string(name='SspUserId'),
      status?: string(name='Status'),
      tenantId?: string(name='TenantId'),
      tenantUserId?: string(name='TenantUserId'),
      userName?: string(name='UserName'),
      yunPersonsId?: string(name='YunPersonsId'),
      yunUid?: string(name='YunUid'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model ListUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListUserResponseBody(name='body'),
}

async function listUserWithOptions(tmpReq: ListUserRequest, runtime: Util.RuntimeOptions): ListUserResponse {
  Util.validateModel(tmpReq);
  var request = new ListUserShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.sspUser)) {
    request.sspUserShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sspUser, 'SspUser', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    body['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sspUserShrink)) {
    body['SspUser'] = request.sspUserShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListUser',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listUser(request: ListUserRequest): ListUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return listUserWithOptions(request, runtime);
}

model ModifyMediaRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  media?: map[string]any(name='Media'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifyMediaShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  mediaShrink?: string(name='Media'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifyMediaResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    accessStatus?: string(name='AccessStatus'),
    accessWay?: string(name='AccessWay'),
    config?: string(name='Config'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    firstScene?: string(name='FirstScene'),
    keyWords?: string(name='KeyWords'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    mediaStatus?: string(name='MediaStatus'),
    mediaType?: string(name='MediaType'),
    modifyTime?: long(name='ModifyTime'),
    os?: string(name='Os'),
    secondScene?: string(name='SecondScene'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyMediaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyMediaResponseBody(name='body'),
}

async function modifyMediaWithOptions(tmpReq: ModifyMediaRequest, runtime: Util.RuntimeOptions): ModifyMediaResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyMediaShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.media)) {
    request.mediaShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.media, 'Media', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.mediaShrink)) {
    body['Media'] = request.mediaShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyMedia',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyMedia(request: ModifyMediaRequest): ModifyMediaResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyMediaWithOptions(request, runtime);
}

model ModifyRuleRequest {
  adRule?: map[string]any(name='AdRule'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifyRuleShrinkRequest {
  adRuleShrink?: string(name='AdRule'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifyRuleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    relatedAdSlots?: string(name='RelatedAdSlots'),
    ruleConfig?: string(name='RuleConfig'),
    ruleId?: string(name='RuleId'),
    ruleName?: string(name='RuleName'),
    ruleRId?: string(name='RuleRId'),
    ruleType?: string(name='RuleType'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyRuleResponseBody(name='body'),
}

async function modifyRuleWithOptions(tmpReq: ModifyRuleRequest, runtime: Util.RuntimeOptions): ModifyRuleResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyRuleShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.adRule)) {
    request.adRuleShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.adRule, 'AdRule', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adRuleShrink)) {
    body['AdRule'] = request.adRuleShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyRule',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyRule(request: ModifyRuleRequest): ModifyRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyRuleWithOptions(request, runtime);
}

model ModifySlotRequest {
  adSlot?: map[string]any(name='AdSlot'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifySlotShrinkRequest {
  adSlotShrink?: string(name='AdSlot'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifySlotResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    adSlotCorporateStatus?: string(name='AdSlotCorporateStatus'),
    adSlotId?: string(name='AdSlotId'),
    adSlotName?: string(name='AdSlotName'),
    adSlotStatus?: string(name='AdSlotStatus'),
    adSlotTemplateId?: string(name='AdSlotTemplateId'),
    adSlotType?: string(name='AdSlotType'),
    blockingRule?: string(name='BlockingRule'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    inspireScene?: string(name='InspireScene'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    modifyTime?: long(name='ModifyTime'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifySlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifySlotResponseBody(name='body'),
}

async function modifySlotWithOptions(tmpReq: ModifySlotRequest, runtime: Util.RuntimeOptions): ModifySlotResponse {
  Util.validateModel(tmpReq);
  var request = new ModifySlotShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.adSlot)) {
    request.adSlotShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.adSlot, 'AdSlot', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adSlotShrink)) {
    body['AdSlot'] = request.adSlotShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifySlot',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifySlot(request: ModifySlotRequest): ModifySlotResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySlotWithOptions(request, runtime);
}

model ModifySlotTemplateRequest {
  adSlotTemplate?: map[string]any(name='AdSlotTemplate'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifySlotTemplateShrinkRequest {
  adSlotTemplateShrink?: string(name='AdSlotTemplate'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifySlotTemplateResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    adSlotTemplateDescription?: string(name='AdSlotTemplateDescription'),
    adSlotTemplateId?: string(name='AdSlotTemplateId'),
    adSlotTemplateName?: string(name='AdSlotTemplateName'),
    adSlotTemplatePic?: string(name='AdSlotTemplatePic'),
    adSlotTemplatePreview?: string(name='AdSlotTemplatePreview'),
    adSlotTemplateTitle?: string(name='AdSlotTemplateTitle'),
    adSlotType?: string(name='AdSlotType'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    templateConfig?: string(name='TemplateConfig'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifySlotTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifySlotTemplateResponseBody(name='body'),
}

async function modifySlotTemplateWithOptions(tmpReq: ModifySlotTemplateRequest, runtime: Util.RuntimeOptions): ModifySlotTemplateResponse {
  Util.validateModel(tmpReq);
  var request = new ModifySlotTemplateShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.adSlotTemplate)) {
    request.adSlotTemplateShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.adSlotTemplate, 'AdSlotTemplate', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adSlotTemplateShrink)) {
    body['AdSlotTemplate'] = request.adSlotTemplateShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifySlotTemplate',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifySlotTemplate(request: ModifySlotTemplateRequest): ModifySlotTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySlotTemplateWithOptions(request, runtime);
}

model ModifyTenantInfoRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenant?: map[string]any(name='Tenant'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifyTenantInfoShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantShrink?: string(name='Tenant'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model ModifyTenantInfoResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    business?: string(name='Business'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    settleInfo?: string(name='SettleInfo'),
    status?: string(name='Status'),
    tenantDescription?: string(name='TenantDescription'),
    tenantId?: string(name='TenantId'),
    tenantName?: string(name='TenantName'),
    userName?: string(name='UserName'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyTenantInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyTenantInfoResponseBody(name='body'),
}

async function modifyTenantInfoWithOptions(tmpReq: ModifyTenantInfoRequest, runtime: Util.RuntimeOptions): ModifyTenantInfoResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyTenantInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tenant)) {
    request.tenantShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tenant, 'Tenant', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.tenantShrink)) {
    body['Tenant'] = request.tenantShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyTenantInfo',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyTenantInfo(request: ModifyTenantInfoRequest): ModifyTenantInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyTenantInfoWithOptions(request, runtime);
}

model PushDeviceStatusRequest {
  channelId?: string(name='ChannelId'),
  deviceSn?: string(name='DeviceSn'),
  status?: int32(name='Status'),
}

model PushDeviceStatusResponseBody = {
  data?: string(name='Data'),
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model PushDeviceStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PushDeviceStatusResponseBody(name='body'),
}

async function pushDeviceStatusWithOptions(request: PushDeviceStatusRequest, runtime: Util.RuntimeOptions): PushDeviceStatusResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.deviceSn)) {
    body['DeviceSn'] = request.deviceSn;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PushDeviceStatus',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pushDeviceStatus(request: PushDeviceStatusRequest): PushDeviceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return pushDeviceStatusWithOptions(request, runtime);
}

model PushExtraTradeDetailRequest {
  channelId?: string(name='ChannelId'),
  commodityId?: string(name='CommodityId'),
  commodityName?: string(name='CommodityName'),
  deviceSn?: string(name='DeviceSn'),
  orderId?: string(name='OrderId'),
  salePrice?: float(name='SalePrice'),
  tradePrice?: float(name='TradePrice'),
  tradeStatus?: int32(name='TradeStatus'),
  tradeTime?: long(name='TradeTime'),
}

model PushExtraTradeDetailResponseBody = {
  data?: string(name='Data'),
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model PushExtraTradeDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PushExtraTradeDetailResponseBody(name='body'),
}

async function pushExtraTradeDetailWithOptions(request: PushExtraTradeDetailRequest, runtime: Util.RuntimeOptions): PushExtraTradeDetailResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.commodityId)) {
    body['CommodityId'] = request.commodityId;
  }
  if (!Util.isUnset(request.commodityName)) {
    body['CommodityName'] = request.commodityName;
  }
  if (!Util.isUnset(request.deviceSn)) {
    body['DeviceSn'] = request.deviceSn;
  }
  if (!Util.isUnset(request.orderId)) {
    body['OrderId'] = request.orderId;
  }
  if (!Util.isUnset(request.salePrice)) {
    body['SalePrice'] = request.salePrice;
  }
  if (!Util.isUnset(request.tradePrice)) {
    body['TradePrice'] = request.tradePrice;
  }
  if (!Util.isUnset(request.tradeStatus)) {
    body['TradeStatus'] = request.tradeStatus;
  }
  if (!Util.isUnset(request.tradeTime)) {
    body['TradeTime'] = request.tradeTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PushExtraTradeDetail',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pushExtraTradeDetail(request: PushExtraTradeDetailRequest): PushExtraTradeDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return pushExtraTradeDetailWithOptions(request, runtime);
}

model PushFaultEventRequest {
  channelId?: string(name='ChannelId'),
  deviceSn?: string(name='DeviceSn'),
  faultComment?: string(name='FaultComment'),
  faultType?: string(name='FaultType'),
  time?: long(name='Time'),
  type?: int32(name='Type'),
}

model PushFaultEventResponseBody = {
  data?: string(name='Data'),
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model PushFaultEventResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PushFaultEventResponseBody(name='body'),
}

async function pushFaultEventWithOptions(request: PushFaultEventRequest, runtime: Util.RuntimeOptions): PushFaultEventResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.deviceSn)) {
    body['DeviceSn'] = request.deviceSn;
  }
  if (!Util.isUnset(request.faultComment)) {
    body['FaultComment'] = request.faultComment;
  }
  if (!Util.isUnset(request.faultType)) {
    body['FaultType'] = request.faultType;
  }
  if (!Util.isUnset(request.time)) {
    body['Time'] = request.time;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PushFaultEvent',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pushFaultEvent(request: PushFaultEventRequest): PushFaultEventResponse {
  var runtime = new Util.RuntimeOptions{};
  return pushFaultEventWithOptions(request, runtime);
}

model PushTradeDetailRequest {
  alipayOrderId?: string(name='AlipayOrderId'),
  channelId?: string(name='ChannelId'),
  commodityId?: string(name='CommodityId'),
  commodityName?: string(name='CommodityName'),
  deviceSn?: string(name='DeviceSn'),
  endTime?: long(name='EndTime'),
  outerTradeId?: string(name='OuterTradeId'),
  salePrice?: float(name='SalePrice'),
  startTime?: long(name='StartTime'),
  tradeOrderId?: string(name='TradeOrderId'),
  tradePrice?: float(name='TradePrice'),
  tradeStatus?: int32(name='TradeStatus'),
  tradeTime?: long(name='TradeTime'),
  verificationStatus?: int32(name='VerificationStatus'),
}

model PushTradeDetailResponseBody = {
  data?: string(name='Data'),
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model PushTradeDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PushTradeDetailResponseBody(name='body'),
}

async function pushTradeDetailWithOptions(request: PushTradeDetailRequest, runtime: Util.RuntimeOptions): PushTradeDetailResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.alipayOrderId)) {
    body['AlipayOrderId'] = request.alipayOrderId;
  }
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.commodityId)) {
    body['CommodityId'] = request.commodityId;
  }
  if (!Util.isUnset(request.commodityName)) {
    body['CommodityName'] = request.commodityName;
  }
  if (!Util.isUnset(request.deviceSn)) {
    body['DeviceSn'] = request.deviceSn;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.outerTradeId)) {
    body['OuterTradeId'] = request.outerTradeId;
  }
  if (!Util.isUnset(request.salePrice)) {
    body['SalePrice'] = request.salePrice;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.tradeOrderId)) {
    body['TradeOrderId'] = request.tradeOrderId;
  }
  if (!Util.isUnset(request.tradePrice)) {
    body['TradePrice'] = request.tradePrice;
  }
  if (!Util.isUnset(request.tradeStatus)) {
    body['TradeStatus'] = request.tradeStatus;
  }
  if (!Util.isUnset(request.tradeTime)) {
    body['TradeTime'] = request.tradeTime;
  }
  if (!Util.isUnset(request.verificationStatus)) {
    body['VerificationStatus'] = request.verificationStatus;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PushTradeDetail',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pushTradeDetail(request: PushTradeDetailRequest): PushTradeDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return pushTradeDetailWithOptions(request, runtime);
}

model QueryAppPromotionRequest {
  channelId?: string(name='ChannelId'),
  extra?: string(name='Extra'),
  userId?: string(name='UserId'),
  userType?: string(name='UserType'),
}

model QueryAppPromotionResponseBody = {
  errorCode?: int32(name='ErrorCode'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId'),
  result?: string(name='Result'),
  success?: boolean(name='Success'),
}

model QueryAppPromotionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryAppPromotionResponseBody(name='body'),
}

async function queryAppPromotionWithOptions(request: QueryAppPromotionRequest, runtime: Util.RuntimeOptions): QueryAppPromotionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.extra)) {
    query['Extra'] = request.extra;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userType)) {
    query['UserType'] = request.userType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryAppPromotion',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryAppPromotion(request: QueryAppPromotionRequest): QueryAppPromotionResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryAppPromotionWithOptions(request, runtime);
}

model QueryAppTasksRequest {
  pageIndex?: int32(name='PageIndex'),
  pageSize?: int32(name='PageSize'),
  taskId?: long(name='TaskId'),
  taskType?: string(name='TaskType'),
}

model QueryAppTasksResponseBody = {
  code?: int32(name='Code'),
  data?: {
    count?: int32(name='Count'),
    list?: [ 
      {
        accountNo?: string(name='AccountNo'),
        allContentStatus?: int32(name='AllContentStatus'),
        balance?: long(name='Balance'),
        balanceDay?: long(name='BalanceDay'),
        brandUserId?: long(name='BrandUserId'),
        chargeCost?: long(name='ChargeCost'),
        contentIds?: string(name='ContentIds'),
        endTime?: string(name='EndTime'),
        id?: long(name='Id'),
        name?: string(name='Name'),
        openScene?: int32(name='OpenScene'),
        popularizePosition?: int32(name='PopularizePosition'),
        priceType?: string(name='PriceType'),
        priority?: int32(name='Priority'),
        proxyUserId?: long(name='ProxyUserId'),
        quota?: long(name='Quota'),
        quotaDay?: long(name='QuotaDay'),
        startTime?: string(name='StartTime'),
        status?: int32(name='Status'),
        timeSchema?: string(name='TimeSchema'),
      }
    ](name='List'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryAppTasksResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryAppTasksResponseBody(name='body'),
}

async function queryAppTasksWithOptions(request: QueryAppTasksRequest, runtime: Util.RuntimeOptions): QueryAppTasksResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageIndex)) {
    query['PageIndex'] = request.pageIndex;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryAppTasks',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryAppTasks(request: QueryAppTasksRequest): QueryAppTasksResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryAppTasksWithOptions(request, runtime);
}

model QueryAvailableBalanceRequest {
  channelId?: string(name='ChannelId'),
  proxyUserId?: long(name='ProxyUserId'),
}

model QueryAvailableBalanceResponseBody = {
  code?: int32(name='Code'),
  data?: long(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryAvailableBalanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryAvailableBalanceResponseBody(name='body'),
}

async function queryAvailableBalanceWithOptions(request: QueryAvailableBalanceRequest, runtime: Util.RuntimeOptions): QueryAvailableBalanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryAvailableBalance',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryAvailableBalance(request: QueryAvailableBalanceRequest): QueryAvailableBalanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryAvailableBalanceWithOptions(request, runtime);
}

model QueryChannelHistoryDataRequest {
  channelId?: string(name='ChannelId'),
  endTime?: string(name='EndTime'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  startTime?: string(name='StartTime'),
  taskType?: string(name='TaskType'),
}

model QueryChannelHistoryDataResponseBody = {
  code?: int32(name='Code'),
  data?: map[string]any(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryChannelHistoryDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryChannelHistoryDataResponseBody(name='body'),
}

async function queryChannelHistoryDataWithOptions(request: QueryChannelHistoryDataRequest, runtime: Util.RuntimeOptions): QueryChannelHistoryDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryChannelHistoryData',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryChannelHistoryData(request: QueryChannelHistoryDataRequest): QueryChannelHistoryDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryChannelHistoryDataWithOptions(request, runtime);
}

model QueryContentInfoRequest {
  contentId?: long(name='ContentId'),
}

model QueryContentInfoResponseBody = {
  code?: int32(name='Code'),
  data?: {
    brandUserId?: long(name='BrandUserId'),
    chainValue?: string(name='ChainValue'),
    id?: long(name='Id'),
    name?: string(name='Name'),
    openScene?: int32(name='OpenScene'),
    proxyUserId?: long(name='ProxyUserId'),
    status?: int32(name='Status'),
    templateType?: string(name='TemplateType'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryContentInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryContentInfoResponseBody(name='body'),
}

async function queryContentInfoWithOptions(request: QueryContentInfoRequest, runtime: Util.RuntimeOptions): QueryContentInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contentId)) {
    query['ContentId'] = request.contentId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryContentInfo',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryContentInfo(request: QueryContentInfoRequest): QueryContentInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryContentInfoWithOptions(request, runtime);
}

model QueryContentListRequest {
  brandUserId?: long(name='BrandUserId'),
  brandUserNick?: string(name='BrandUserNick'),
  channelId?: string(name='ChannelId'),
  proxyUserId?: long(name='ProxyUserId'),
  taskBizType?: string(name='TaskBizType'),
  taskType?: string(name='TaskType'),
}

model QueryContentListResponseBody = {
  code?: int32(name='Code'),
  data?: [  map[string]any ](name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryContentListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryContentListResponseBody(name='body'),
}

async function queryContentListWithOptions(request: QueryContentListRequest, runtime: Util.RuntimeOptions): QueryContentListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.brandUserId)) {
    query['BrandUserId'] = request.brandUserId;
  }
  if (!Util.isUnset(request.brandUserNick)) {
    query['BrandUserNick'] = request.brandUserNick;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.taskBizType)) {
    query['TaskBizType'] = request.taskBizType;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryContentList',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryContentList(request: QueryContentListRequest): QueryContentListResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryContentListWithOptions(request, runtime);
}

model QueryFlowRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  flowId?: string(name='FlowId'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryFlowResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    applyUserId?: string(name='ApplyUserId'),
    approveTime?: long(name='ApproveTime'),
    approveUserId?: string(name='ApproveUserId'),
    businessKey?: string(name='BusinessKey'),
    childStatus?: string(name='ChildStatus'),
    extInfo?: string(name='ExtInfo'),
    flowId?: string(name='FlowId'),
    gmtCreateTime?: long(name='GmtCreateTime'),
    gmtModifiedTime?: long(name='GmtModifiedTime'),
    newData?: string(name='NewData'),
    oldData?: string(name='OldData'),
    reasonType?: string(name='ReasonType'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    type?: string(name='Type'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryFlowResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryFlowResponseBody(name='body'),
}

async function queryFlowWithOptions(request: QueryFlowRequest, runtime: Util.RuntimeOptions): QueryFlowResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryFlow',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryFlow(request: QueryFlowRequest): QueryFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryFlowWithOptions(request, runtime);
}

model QueryIncomeDataRequest {
  adSlotId?: string(name='AdSlotId'),
  adSlotName?: string(name='AdSlotName'),
  adSlotType?: string(name='AdSlotType'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  dimension?: string(name='Dimension'),
  endTime?: long(name='EndTime'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  mediaName?: map[string]any(name='MediaName'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  queryType?: string(name='QueryType'),
  startTime?: long(name='StartTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryIncomeDataShrinkRequest {
  adSlotId?: string(name='AdSlotId'),
  adSlotName?: string(name='AdSlotName'),
  adSlotType?: string(name='AdSlotType'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  dimension?: string(name='Dimension'),
  endTime?: long(name='EndTime'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  mediaNameShrink?: string(name='MediaName'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  queryType?: string(name='QueryType'),
  startTime?: long(name='StartTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryIncomeDataResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    accEstIncomeRate?: string(name='AccEstIncomeRate'),
    accessStatus?: long(name='AccessStatus'),
    accumulatedIncome?: long(name='AccumulatedIncome'),
    adSlotClickRate?: string(name='AdSlotClickRate'),
    adSlotHitRate?: string(name='AdSlotHitRate'),
    adSlotHitTimes?: long(name='AdSlotHitTimes'),
    adSlotId?: string(name='AdSlotId'),
    adSlotName?: string(name='AdSlotName'),
    adSlotRequests?: long(name='AdSlotRequests'),
    adSlotShowRate?: string(name='AdSlotShowRate'),
    adSlotType?: string(name='AdSlotType'),
    channelId?: string(name='ChannelId'),
    channelName?: string(name='ChannelName'),
    clickTimes?: long(name='ClickTimes'),
    ecpm?: long(name='Ecpm'),
    ecpmRate?: string(name='EcpmRate'),
    endTime?: long(name='EndTime'),
    estimatedIncome?: long(name='EstimatedIncome'),
    lastDayEstimatedIncome?: long(name='LastDayEstimatedIncome'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    showTimes?: long(name='ShowTimes'),
    startTime?: long(name='StartTime'),
    thisDaysEstIncome?: long(name='ThisDaysEstIncome'),
    thisDaysEstIncomeRate?: string(name='ThisDaysEstIncomeRate'),
    thisMonEstIncomeRate?: string(name='ThisMonEstIncomeRate'),
    thisMonEstimatedIncome?: long(name='ThisMonEstimatedIncome'),
    thisYearEstIncomeRate?: string(name='ThisYearEstIncomeRate'),
    thisYearIncome?: long(name='ThisYearIncome'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryIncomeDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryIncomeDataResponseBody(name='body'),
}

async function queryIncomeDataWithOptions(tmpReq: QueryIncomeDataRequest, runtime: Util.RuntimeOptions): QueryIncomeDataResponse {
  Util.validateModel(tmpReq);
  var request = new QueryIncomeDataShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.mediaName)) {
    request.mediaNameShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.mediaName, 'MediaName', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.adSlotId)) {
    query['AdSlotId'] = request.adSlotId;
  }
  if (!Util.isUnset(request.adSlotName)) {
    query['AdSlotName'] = request.adSlotName;
  }
  if (!Util.isUnset(request.adSlotType)) {
    query['AdSlotType'] = request.adSlotType;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.dimension)) {
    query['Dimension'] = request.dimension;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.mediaId)) {
    query['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.mediaNameShrink)) {
    query['MediaName'] = request.mediaNameShrink;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.queryType)) {
    query['QueryType'] = request.queryType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryIncomeData',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryIncomeData(request: QueryIncomeDataRequest): QueryIncomeDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryIncomeDataWithOptions(request, runtime);
}

model QueryIncomeTrendRequest {
  adSlotId?: string(name='AdSlotId'),
  adSlotName?: string(name='AdSlotName'),
  adSlotType?: string(name='AdSlotType'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  dimension?: string(name='Dimension'),
  endTime?: long(name='EndTime'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  mediaName?: map[string]any(name='MediaName'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  queryType?: string(name='QueryType'),
  slot?: long(name='Slot'),
  slotDimension?: string(name='SlotDimension'),
  startTime?: long(name='StartTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryIncomeTrendShrinkRequest {
  adSlotId?: string(name='AdSlotId'),
  adSlotName?: string(name='AdSlotName'),
  adSlotType?: string(name='AdSlotType'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  dimension?: string(name='Dimension'),
  endTime?: long(name='EndTime'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  mediaNameShrink?: string(name='MediaName'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  queryType?: string(name='QueryType'),
  slot?: long(name='Slot'),
  slotDimension?: string(name='SlotDimension'),
  startTime?: long(name='StartTime'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryIncomeTrendResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      accEstIncomeRate?: string(name='AccEstIncomeRate'),
      accessStatus?: long(name='AccessStatus'),
      adSlotClickRate?: string(name='AdSlotClickRate'),
      adSlotHitRate?: string(name='AdSlotHitRate'),
      adSlotHitTimes?: long(name='AdSlotHitTimes'),
      adSlotId?: string(name='AdSlotId'),
      adSlotName?: string(name='AdSlotName'),
      adSlotRequests?: long(name='AdSlotRequests'),
      adSlotShowRate?: string(name='AdSlotShowRate'),
      adSlotType?: string(name='AdSlotType'),
      bizDate?: long(name='BizDate'),
      channelId?: string(name='ChannelId'),
      channelName?: string(name='ChannelName'),
      clickTimes?: long(name='ClickTimes'),
      ecpm?: long(name='Ecpm'),
      ecpmRate?: string(name='EcpmRate'),
      endTime?: long(name='EndTime'),
      estimatedIncome?: long(name='EstimatedIncome'),
      mediaId?: string(name='MediaId'),
      mediaName?: string(name='MediaName'),
      showTimes?: long(name='ShowTimes'),
      startTime?: long(name='StartTime'),
      thisDaysEstIncome?: long(name='ThisDaysEstIncome'),
      thisDaysEstIncomeRate?: string(name='ThisDaysEstIncomeRate'),
      thisMonEstIncomeRate?: string(name='ThisMonEstIncomeRate'),
      thisYearEstIncomeRate?: string(name='ThisYearEstIncomeRate'),
    }
  ](name='Model'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  total?: long(name='Total'),
}

model QueryIncomeTrendResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryIncomeTrendResponseBody(name='body'),
}

async function queryIncomeTrendWithOptions(tmpReq: QueryIncomeTrendRequest, runtime: Util.RuntimeOptions): QueryIncomeTrendResponse {
  Util.validateModel(tmpReq);
  var request = new QueryIncomeTrendShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.mediaName)) {
    request.mediaNameShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.mediaName, 'MediaName', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.adSlotId)) {
    query['AdSlotId'] = request.adSlotId;
  }
  if (!Util.isUnset(request.adSlotName)) {
    query['AdSlotName'] = request.adSlotName;
  }
  if (!Util.isUnset(request.adSlotType)) {
    query['AdSlotType'] = request.adSlotType;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.dimension)) {
    query['Dimension'] = request.dimension;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.mediaId)) {
    query['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.mediaNameShrink)) {
    query['MediaName'] = request.mediaNameShrink;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.queryType)) {
    query['QueryType'] = request.queryType;
  }
  if (!Util.isUnset(request.slot)) {
    query['Slot'] = request.slot;
  }
  if (!Util.isUnset(request.slotDimension)) {
    query['SlotDimension'] = request.slotDimension;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryIncomeTrend',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryIncomeTrend(request: QueryIncomeTrendRequest): QueryIncomeTrendResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryIncomeTrendWithOptions(request, runtime);
}

model QueryIndustryLabelBagRequest {
  channelId?: string(name='ChannelId'),
}

model QueryIndustryLabelBagResponseBody = {
  code?: int32(name='Code'),
  data?: [  map[string]any ](name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryIndustryLabelBagResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryIndustryLabelBagResponseBody(name='body'),
}

async function queryIndustryLabelBagWithOptions(request: QueryIndustryLabelBagRequest, runtime: Util.RuntimeOptions): QueryIndustryLabelBagResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryIndustryLabelBag',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryIndustryLabelBag(request: QueryIndustryLabelBagRequest): QueryIndustryLabelBagResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryIndustryLabelBagWithOptions(request, runtime);
}

model QueryMediaRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  mediaId?: string(name='MediaId'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryMediaResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    accessStatus?: string(name='AccessStatus'),
    accessWay?: string(name='AccessWay'),
    config?: string(name='Config'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    firstScene?: string(name='FirstScene'),
    keyWords?: string(name='KeyWords'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    mediaStatus?: string(name='MediaStatus'),
    mediaType?: string(name='MediaType'),
    modifyTime?: long(name='ModifyTime'),
    os?: string(name='Os'),
    secondScene?: string(name='SecondScene'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryMediaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryMediaResponseBody(name='body'),
}

async function queryMediaWithOptions(request: QueryMediaRequest, runtime: Util.RuntimeOptions): QueryMediaResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.mediaId)) {
    query['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryMedia',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryMedia(request: QueryMediaRequest): QueryMediaResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryMediaWithOptions(request, runtime);
}

model QueryPromotionRequest {
  alipayOpenId?: string(name='AlipayOpenId'),
  channelId?: string(name='ChannelId'),
  extra?: string(name='Extra'),
  proxyChannelId?: string(name='ProxyChannelId'),
  userId?: string(name='UserId'),
}

model QueryPromotionResponseBody = {
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  noPromotionUrl?: string(name='NoPromotionUrl'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
  unionAmount?: string(name='UnionAmount'),
  url?: string(name='Url'),
}

model QueryPromotionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryPromotionResponseBody(name='body'),
}

async function queryPromotionWithOptions(request: QueryPromotionRequest, runtime: Util.RuntimeOptions): QueryPromotionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.alipayOpenId)) {
    body['AlipayOpenId'] = request.alipayOpenId;
  }
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.extra)) {
    body['Extra'] = request.extra;
  }
  if (!Util.isUnset(request.proxyChannelId)) {
    body['ProxyChannelId'] = request.proxyChannelId;
  }
  if (!Util.isUnset(request.userId)) {
    body['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryPromotion',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryPromotion(request: QueryPromotionRequest): QueryPromotionResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryPromotionWithOptions(request, runtime);
}

model QueryRuleRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  ruleId?: string(name='RuleId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryRuleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    accessStatus?: string(name='AccessStatus'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    relatedAdSlots?: string(name='RelatedAdSlots'),
    ruleConfig?: string(name='RuleConfig'),
    ruleId?: string(name='RuleId'),
    ruleName?: string(name='RuleName'),
    ruleRId?: string(name='RuleRId'),
    ruleType?: string(name='RuleType'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryRuleResponseBody(name='body'),
}

async function queryRuleWithOptions(request: QueryRuleRequest, runtime: Util.RuntimeOptions): QueryRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryRule',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryRule(request: QueryRuleRequest): QueryRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryRuleWithOptions(request, runtime);
}

model QuerySlotRequest {
  adSlotId?: string(name='AdSlotId'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QuerySlotResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    adSlotCorporateStatus?: string(name='AdSlotCorporateStatus'),
    adSlotId?: string(name='AdSlotId'),
    adSlotName?: string(name='AdSlotName'),
    adSlotStatus?: string(name='AdSlotStatus'),
    adSlotTemplateId?: string(name='AdSlotTemplateId'),
    adSlotType?: string(name='AdSlotType'),
    blockingRule?: string(name='BlockingRule'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    inspireScene?: string(name='InspireScene'),
    mediaId?: string(name='MediaId'),
    mediaName?: string(name='MediaName'),
    modifyTime?: long(name='ModifyTime'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QuerySlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QuerySlotResponseBody(name='body'),
}

async function querySlotWithOptions(request: QuerySlotRequest, runtime: Util.RuntimeOptions): QuerySlotResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adSlotId)) {
    query['AdSlotId'] = request.adSlotId;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySlot',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function querySlot(request: QuerySlotRequest): QuerySlotResponse {
  var runtime = new Util.RuntimeOptions{};
  return querySlotWithOptions(request, runtime);
}

model QuerySlotTemplateRequest {
  adSlotTemplateId?: string(name='AdSlotTemplateId'),
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QuerySlotTemplateResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    adSlotTemplateDescription?: string(name='AdSlotTemplateDescription'),
    adSlotTemplateId?: string(name='AdSlotTemplateId'),
    adSlotTemplateName?: string(name='AdSlotTemplateName'),
    adSlotTemplatePic?: string(name='AdSlotTemplatePic'),
    adSlotTemplatePreview?: string(name='AdSlotTemplatePreview'),
    adSlotTemplateTitle?: string(name='AdSlotTemplateTitle'),
    adSlotType?: string(name='AdSlotType'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    templateConfig?: string(name='TemplateConfig'),
    tenantId?: string(name='TenantId'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QuerySlotTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QuerySlotTemplateResponseBody(name='body'),
}

async function querySlotTemplateWithOptions(request: QuerySlotTemplateRequest, runtime: Util.RuntimeOptions): QuerySlotTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adSlotTemplateId)) {
    query['AdSlotTemplateId'] = request.adSlotTemplateId;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySlotTemplate',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function querySlotTemplate(request: QuerySlotTemplateRequest): QuerySlotTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return querySlotTemplateWithOptions(request, runtime);
}

model QueryTaskBizTypeRequest {
  channelId?: string(name='ChannelId'),
}

model QueryTaskBizTypeResponseBody = {
  code?: int32(name='Code'),
  data?: [  map[string]any ](name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTaskBizTypeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTaskBizTypeResponseBody(name='body'),
}

async function queryTaskBizTypeWithOptions(request: QueryTaskBizTypeRequest, runtime: Util.RuntimeOptions): QueryTaskBizTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTaskBizType',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTaskBizType(request: QueryTaskBizTypeRequest): QueryTaskBizTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTaskBizTypeWithOptions(request, runtime);
}

model QueryTaskRuleLimitRequest {
  channelId?: string(name='ChannelId'),
}

model QueryTaskRuleLimitResponseBody = {
  code?: int32(name='Code'),
  data?: [  map[string]any ](name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTaskRuleLimitResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTaskRuleLimitResponseBody(name='body'),
}

async function queryTaskRuleLimitWithOptions(request: QueryTaskRuleLimitRequest, runtime: Util.RuntimeOptions): QueryTaskRuleLimitResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTaskRuleLimit',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTaskRuleLimit(request: QueryTaskRuleLimitRequest): QueryTaskRuleLimitResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTaskRuleLimitWithOptions(request, runtime);
}

model QueryTaskRulesRequest {
  taskId?: long(name='TaskId'),
  taskRuleType?: string(name='TaskRuleType'),
}

model QueryTaskRulesResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      content?: string(name='Content'),
      id?: int32(name='Id'),
      taskId?: long(name='TaskId'),
      type?: int32(name='Type'),
    }
  ](name='Data'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTaskRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTaskRulesResponseBody(name='body'),
}

async function queryTaskRulesWithOptions(request: QueryTaskRulesRequest, runtime: Util.RuntimeOptions): QueryTaskRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.taskRuleType)) {
    query['TaskRuleType'] = request.taskRuleType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTaskRules',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTaskRules(request: QueryTaskRulesRequest): QueryTaskRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTaskRulesWithOptions(request, runtime);
}

model QueryTenantBizConfigRequest {
  appName?: string(name='AppName'),
  bizId?: string(name='BizId'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryTenantBizConfigResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: [ 
    {
      bizId?: string(name='BizId'),
      configDescription?: string(name='ConfigDescription'),
      configValueType?: string(name='ConfigValueType'),
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTenantBizConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTenantBizConfigResponseBody(name='body'),
}

async function queryTenantBizConfigWithOptions(request: QueryTenantBizConfigRequest, runtime: Util.RuntimeOptions): QueryTenantBizConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.bizId)) {
    query['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTenantBizConfig',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTenantBizConfig(request: QueryTenantBizConfigRequest): QueryTenantBizConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTenantBizConfigWithOptions(request, runtime);
}

model QueryTenantInfoRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryTenantInfoResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    business?: string(name='Business'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    settleInfo?: string(name='SettleInfo'),
    status?: string(name='Status'),
    tenantDescription?: string(name='TenantDescription'),
    tenantId?: string(name='TenantId'),
    tenantName?: string(name='TenantName'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTenantInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTenantInfoResponseBody(name='body'),
}

async function queryTenantInfoWithOptions(request: QueryTenantInfoRequest, runtime: Util.RuntimeOptions): QueryTenantInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTenantInfo',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTenantInfo(request: QueryTenantInfoRequest): QueryTenantInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTenantInfoWithOptions(request, runtime);
}

model QueryTenantUserRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryTenantUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    business?: string(name='Business'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    originSite?: string(name='OriginSite'),
    originSiteUserId?: string(name='OriginSiteUserId'),
    originSiteUserName?: string(name='OriginSiteUserName'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    tenantName?: string(name='TenantName'),
    userId?: string(name='UserId'),
    userName?: string(name='UserName'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTenantUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTenantUserResponseBody(name='body'),
}

async function queryTenantUserWithOptions(request: QueryTenantUserRequest, runtime: Util.RuntimeOptions): QueryTenantUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTenantUser',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTenantUser(request: QueryTenantUserRequest): QueryTenantUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTenantUserWithOptions(request, runtime);
}

model QueryTenantUserByUserIdRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryTenantUserByUserIdResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    business?: string(name='Business'),
    createTime?: long(name='CreateTime'),
    extInfo?: string(name='ExtInfo'),
    modifyTime?: long(name='ModifyTime'),
    originSite?: string(name='OriginSite'),
    originSiteUserId?: string(name='OriginSiteUserId'),
    originSiteUserName?: string(name='OriginSiteUserName'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    tenantName?: string(name='TenantName'),
    userId?: string(name='UserId'),
    userName?: string(name='UserName'),
    version?: long(name='Version'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTenantUserByUserIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTenantUserByUserIdResponseBody(name='body'),
}

async function queryTenantUserByUserIdWithOptions(request: QueryTenantUserByUserIdRequest, runtime: Util.RuntimeOptions): QueryTenantUserByUserIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTenantUserByUserId',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTenantUserByUserId(request: QueryTenantUserByUserIdRequest): QueryTenantUserByUserIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTenantUserByUserIdWithOptions(request, runtime);
}

model QueryUnionChannelRequest {
  channelId?: string(name='ChannelId'),
}

model QueryUnionChannelResponseBody = {
  code?: int32(name='Code'),
  data?: map[string]any(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryUnionChannelResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryUnionChannelResponseBody(name='body'),
}

async function queryUnionChannelWithOptions(request: QueryUnionChannelRequest, runtime: Util.RuntimeOptions): QueryUnionChannelResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryUnionChannel',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryUnionChannel(request: QueryUnionChannelRequest): QueryUnionChannelResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryUnionChannelWithOptions(request, runtime);
}

model QueryUnionContentInfoRequest {
  channelId?: string(name='ChannelId'),
  contentId?: string(name='ContentId'),
  proxyUserId?: long(name='ProxyUserId'),
}

model QueryUnionContentInfoResponseBody = {
  code?: int32(name='Code'),
  data?: map[string]any(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryUnionContentInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryUnionContentInfoResponseBody(name='body'),
}

async function queryUnionContentInfoWithOptions(request: QueryUnionContentInfoRequest, runtime: Util.RuntimeOptions): QueryUnionContentInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.contentId)) {
    query['ContentId'] = request.contentId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryUnionContentInfo',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryUnionContentInfo(request: QueryUnionContentInfoRequest): QueryUnionContentInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryUnionContentInfoWithOptions(request, runtime);
}

model QueryUnionPromotionRequest {
  alipayOpenId?: long(name='AlipayOpenId'),
  channelId?: string(name='ChannelId'),
  proxyChannelId?: string(name='ProxyChannelId'),
  sign?: string(name='Sign'),
  unionBizType?: string(name='UnionBizType'),
  userId?: long(name='UserId'),
  userNick?: string(name='UserNick'),
}

model QueryUnionPromotionResponseBody = {
  bizErrorCode?: string(name='BizErrorCode'),
  errorCode?: int32(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  result?: [  map[string]any ](name='Result'),
  success?: boolean(name='Success'),
}

model QueryUnionPromotionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryUnionPromotionResponseBody(name='body'),
}

async function queryUnionPromotionWithOptions(request: QueryUnionPromotionRequest, runtime: Util.RuntimeOptions): QueryUnionPromotionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alipayOpenId)) {
    query['AlipayOpenId'] = request.alipayOpenId;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyChannelId)) {
    query['ProxyChannelId'] = request.proxyChannelId;
  }
  if (!Util.isUnset(request.sign)) {
    query['Sign'] = request.sign;
  }
  if (!Util.isUnset(request.unionBizType)) {
    query['UnionBizType'] = request.unionBizType;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userNick)) {
    query['UserNick'] = request.userNick;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryUnionPromotion',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryUnionPromotion(request: QueryUnionPromotionRequest): QueryUnionPromotionResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryUnionPromotionWithOptions(request, runtime);
}

model QueryUnionSumChannelDataRequest {
  channelId?: string(name='ChannelId'),
  taskType?: string(name='TaskType'),
}

model QueryUnionSumChannelDataResponseBody = {
  code?: int32(name='Code'),
  data?: map[string]any(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryUnionSumChannelDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryUnionSumChannelDataResponseBody(name='body'),
}

async function queryUnionSumChannelDataWithOptions(request: QueryUnionSumChannelDataRequest, runtime: Util.RuntimeOptions): QueryUnionSumChannelDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryUnionSumChannelData',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryUnionSumChannelData(request: QueryUnionSumChannelDataRequest): QueryUnionSumChannelDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryUnionSumChannelDataWithOptions(request, runtime);
}

model QueryUnionTaskInfoRequest {
  channelId?: string(name='ChannelId'),
  proxyUserId?: long(name='ProxyUserId'),
  taskId?: long(name='TaskId'),
}

model QueryUnionTaskInfoResponseBody = {
  code?: int32(name='Code'),
  data?: map[string]any(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryUnionTaskInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryUnionTaskInfoResponseBody(name='body'),
}

async function queryUnionTaskInfoWithOptions(request: QueryUnionTaskInfoRequest, runtime: Util.RuntimeOptions): QueryUnionTaskInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryUnionTaskInfo',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryUnionTaskInfo(request: QueryUnionTaskInfoRequest): QueryUnionTaskInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryUnionTaskInfoWithOptions(request, runtime);
}

model QueryUnionTaskListRequest {
  brandUserId?: long(name='BrandUserId'),
  brandUserNick?: string(name='BrandUserNick'),
  channelId?: string(name='ChannelId'),
  pageIndex?: int32(name='PageIndex'),
  pageSize?: int32(name='PageSize'),
  proxyUserId?: long(name='ProxyUserId'),
}

model QueryUnionTaskListResponseBody = {
  code?: int32(name='Code'),
  data?: map[string]any(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryUnionTaskListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryUnionTaskListResponseBody(name='body'),
}

async function queryUnionTaskListWithOptions(request: QueryUnionTaskListRequest, runtime: Util.RuntimeOptions): QueryUnionTaskListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.brandUserId)) {
    query['BrandUserId'] = request.brandUserId;
  }
  if (!Util.isUnset(request.brandUserNick)) {
    query['BrandUserNick'] = request.brandUserNick;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.pageIndex)) {
    query['PageIndex'] = request.pageIndex;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryUnionTaskList',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryUnionTaskList(request: QueryUnionTaskListRequest): QueryUnionTaskListResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryUnionTaskListWithOptions(request, runtime);
}

model QueryUserRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  sspUser?: map[string]any(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryUserShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  sspUserShrink?: string(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model QueryUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    email?: string(name='Email'),
    gmtCreateTime?: long(name='GmtCreateTime'),
    gmtModifiedTime?: long(name='GmtModifiedTime'),
    isDeleteTag?: string(name='IsDeleteTag'),
    mobilePhone?: string(name='MobilePhone'),
    roleCode?: string(name='RoleCode'),
    sspUserId?: string(name='SspUserId'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    tenantUserId?: string(name='TenantUserId'),
    userName?: string(name='UserName'),
    yunPersonsId?: string(name='YunPersonsId'),
    yunUid?: string(name='YunUid'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryUserResponseBody(name='body'),
}

async function queryUserWithOptions(tmpReq: QueryUserRequest, runtime: Util.RuntimeOptions): QueryUserResponse {
  Util.validateModel(tmpReq);
  var request = new QueryUserShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.sspUser)) {
    request.sspUserShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sspUser, 'SspUser', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.sspUserShrink)) {
    body['SspUser'] = request.sspUserShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryUser',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryUser(request: QueryUserRequest): QueryUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryUserWithOptions(request, runtime);
}

model ReduceAmountRequest {
  amount?: long(name='Amount'),
  channelId?: string(name='ChannelId'),
  taskId?: long(name='TaskId'),
  v?: string(name='V'),
}

model ReduceAmountResponseBody = {
  data?: {
    chargeDetail?: string(name='ChargeDetail'),
    price?: long(name='Price'),
    taskId?: long(name='TaskId'),
  }(name='Data'),
  errorCode?: int32(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ReduceAmountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReduceAmountResponseBody(name='body'),
}

async function reduceAmountWithOptions(request: ReduceAmountRequest, runtime: Util.RuntimeOptions): ReduceAmountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.amount)) {
    query['Amount'] = request.amount;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.v)) {
    query['V'] = request.v;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReduceAmount',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function reduceAmount(request: ReduceAmountRequest): ReduceAmountResponse {
  var runtime = new Util.RuntimeOptions{};
  return reduceAmountWithOptions(request, runtime);
}

model RegistDeviceRequest {
  channelId?: string(name='ChannelId'),
  city?: string(name='City'),
  detailAddr?: string(name='DetailAddr'),
  deviceModelNumber?: string(name='DeviceModelNumber'),
  deviceName?: string(name='DeviceName'),
  deviceType?: string(name='DeviceType'),
  district?: string(name='District'),
  firstScene?: string(name='FirstScene'),
  floor?: string(name='Floor'),
  locationName?: string(name='LocationName'),
  outerCode?: string(name='OuterCode'),
  province?: string(name='Province'),
  secondScene?: string(name='SecondScene'),
}

model RegistDeviceResponseBody = {
  data?: string(name='Data'),
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model RegistDeviceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RegistDeviceResponseBody(name='body'),
}

async function registDeviceWithOptions(request: RegistDeviceRequest, runtime: Util.RuntimeOptions): RegistDeviceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.city)) {
    body['City'] = request.city;
  }
  if (!Util.isUnset(request.detailAddr)) {
    body['DetailAddr'] = request.detailAddr;
  }
  if (!Util.isUnset(request.deviceModelNumber)) {
    body['DeviceModelNumber'] = request.deviceModelNumber;
  }
  if (!Util.isUnset(request.deviceName)) {
    body['DeviceName'] = request.deviceName;
  }
  if (!Util.isUnset(request.deviceType)) {
    body['DeviceType'] = request.deviceType;
  }
  if (!Util.isUnset(request.district)) {
    body['District'] = request.district;
  }
  if (!Util.isUnset(request.firstScene)) {
    body['FirstScene'] = request.firstScene;
  }
  if (!Util.isUnset(request.floor)) {
    body['Floor'] = request.floor;
  }
  if (!Util.isUnset(request.locationName)) {
    body['LocationName'] = request.locationName;
  }
  if (!Util.isUnset(request.outerCode)) {
    body['OuterCode'] = request.outerCode;
  }
  if (!Util.isUnset(request.province)) {
    body['Province'] = request.province;
  }
  if (!Util.isUnset(request.secondScene)) {
    body['SecondScene'] = request.secondScene;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RegistDevice',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function registDevice(request: RegistDeviceRequest): RegistDeviceResponse {
  var runtime = new Util.RuntimeOptions{};
  return registDeviceWithOptions(request, runtime);
}

model SaveCpmTradeRequest {
  advertType?: string(name='AdvertType'),
  age?: int32(name='Age'),
  applyPrice?: string(name='ApplyPrice'),
  bizType?: string(name='BizType'),
  channelId?: string(name='ChannelId'),
  chargeType?: string(name='ChargeType'),
  costDetail?: string(name='CostDetail'),
  deviceCode?: string(name='DeviceCode'),
  extendString?: string(name='ExtendString'),
  holdId?: string(name='HoldId'),
  outerCode?: string(name='OuterCode'),
  realCostAmount?: string(name='RealCostAmount'),
  sex?: string(name='Sex'),
  taskId?: string(name='TaskId'),
  taskTag?: string(name='TaskTag'),
  taskType?: string(name='TaskType'),
  tradeTime?: long(name='TradeTime'),
  v?: string(name='V'),
}

model SaveCpmTradeResponseBody = {
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model SaveCpmTradeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SaveCpmTradeResponseBody(name='body'),
}

async function saveCpmTradeWithOptions(request: SaveCpmTradeRequest, runtime: Util.RuntimeOptions): SaveCpmTradeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.advertType)) {
    query['AdvertType'] = request.advertType;
  }
  if (!Util.isUnset(request.age)) {
    query['Age'] = request.age;
  }
  if (!Util.isUnset(request.applyPrice)) {
    query['ApplyPrice'] = request.applyPrice;
  }
  if (!Util.isUnset(request.bizType)) {
    query['BizType'] = request.bizType;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.chargeType)) {
    query['ChargeType'] = request.chargeType;
  }
  if (!Util.isUnset(request.costDetail)) {
    query['CostDetail'] = request.costDetail;
  }
  if (!Util.isUnset(request.deviceCode)) {
    query['DeviceCode'] = request.deviceCode;
  }
  if (!Util.isUnset(request.extendString)) {
    query['ExtendString'] = request.extendString;
  }
  if (!Util.isUnset(request.holdId)) {
    query['HoldId'] = request.holdId;
  }
  if (!Util.isUnset(request.outerCode)) {
    query['OuterCode'] = request.outerCode;
  }
  if (!Util.isUnset(request.realCostAmount)) {
    query['RealCostAmount'] = request.realCostAmount;
  }
  if (!Util.isUnset(request.sex)) {
    query['Sex'] = request.sex;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.taskTag)) {
    query['TaskTag'] = request.taskTag;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  if (!Util.isUnset(request.tradeTime)) {
    query['TradeTime'] = request.tradeTime;
  }
  if (!Util.isUnset(request.v)) {
    query['V'] = request.v;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SaveCpmTrade',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function saveCpmTrade(request: SaveCpmTradeRequest): SaveCpmTradeResponse {
  var runtime = new Util.RuntimeOptions{};
  return saveCpmTradeWithOptions(request, runtime);
}

model ScanCodeNotificationRequest {
  age?: int32(name='Age'),
  alipayOpenId?: string(name='AlipayOpenId'),
  applyPrice?: int32(name='ApplyPrice'),
  bizResult?: string(name='BizResult'),
  bizType?: string(name='BizType'),
  brandNick?: string(name='BrandNick'),
  brandUserId?: string(name='BrandUserId'),
  channelId?: string(name='ChannelId'),
  chargeTag?: string(name='ChargeTag'),
  cid?: string(name='Cid'),
  commodityId?: string(name='CommodityId'),
  costDetail?: string(name='CostDetail'),
  deviceCode?: string(name='DeviceCode'),
  deviceType?: string(name='DeviceType'),
  holderId?: string(name='HolderId'),
  outerCode?: string(name='OuterCode'),
  phase?: string(name='Phase'),
  proxyUserId?: string(name='ProxyUserId'),
  queryStr?: string(name='QueryStr'),
  realCostAmount?: string(name='RealCostAmount'),
  salePrice?: int32(name='SalePrice'),
  sex?: string(name='Sex'),
  taskId?: string(name='TaskId'),
  taskType?: string(name='TaskType'),
  tradeTimeStr?: string(name='TradeTimeStr'),
  v?: string(name='V'),
}

model ScanCodeNotificationResponseBody = {
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model ScanCodeNotificationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ScanCodeNotificationResponseBody(name='body'),
}

async function scanCodeNotificationWithOptions(request: ScanCodeNotificationRequest, runtime: Util.RuntimeOptions): ScanCodeNotificationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.age)) {
    query['Age'] = request.age;
  }
  if (!Util.isUnset(request.alipayOpenId)) {
    query['AlipayOpenId'] = request.alipayOpenId;
  }
  if (!Util.isUnset(request.applyPrice)) {
    query['ApplyPrice'] = request.applyPrice;
  }
  if (!Util.isUnset(request.bizResult)) {
    query['BizResult'] = request.bizResult;
  }
  if (!Util.isUnset(request.bizType)) {
    query['BizType'] = request.bizType;
  }
  if (!Util.isUnset(request.brandNick)) {
    query['BrandNick'] = request.brandNick;
  }
  if (!Util.isUnset(request.brandUserId)) {
    query['BrandUserId'] = request.brandUserId;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.chargeTag)) {
    query['ChargeTag'] = request.chargeTag;
  }
  if (!Util.isUnset(request.cid)) {
    query['Cid'] = request.cid;
  }
  if (!Util.isUnset(request.commodityId)) {
    query['CommodityId'] = request.commodityId;
  }
  if (!Util.isUnset(request.costDetail)) {
    query['CostDetail'] = request.costDetail;
  }
  if (!Util.isUnset(request.deviceCode)) {
    query['DeviceCode'] = request.deviceCode;
  }
  if (!Util.isUnset(request.deviceType)) {
    query['DeviceType'] = request.deviceType;
  }
  if (!Util.isUnset(request.holderId)) {
    query['HolderId'] = request.holderId;
  }
  if (!Util.isUnset(request.outerCode)) {
    query['OuterCode'] = request.outerCode;
  }
  if (!Util.isUnset(request.phase)) {
    query['Phase'] = request.phase;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.queryStr)) {
    query['QueryStr'] = request.queryStr;
  }
  if (!Util.isUnset(request.realCostAmount)) {
    query['RealCostAmount'] = request.realCostAmount;
  }
  if (!Util.isUnset(request.salePrice)) {
    query['SalePrice'] = request.salePrice;
  }
  if (!Util.isUnset(request.sex)) {
    query['Sex'] = request.sex;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  if (!Util.isUnset(request.tradeTimeStr)) {
    query['TradeTimeStr'] = request.tradeTimeStr;
  }
  if (!Util.isUnset(request.v)) {
    query['V'] = request.v;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ScanCodeNotification',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function scanCodeNotification(request: ScanCodeNotificationRequest): ScanCodeNotificationResponse {
  var runtime = new Util.RuntimeOptions{};
  return scanCodeNotificationWithOptions(request, runtime);
}

model SearchAdvertisingRequest {
  app?: {
    ext?: map[string]any(name='Ext'),
    mediaid?: string(name='Mediaid'),
    sn?: string(name='Sn'),
  }(name='App'),
  device?: {
    androidid?: string(name='Androidid'),
    androidmd5?: string(name='Androidmd5'),
    caid?: string(name='Caid'),
    carrier?: string(name='Carrier'),
    connectiontype?: int32(name='Connectiontype'),
    devicetype?: int32(name='Devicetype'),
    geo?: {
      city?: string(name='City'),
      district?: string(name='District'),
      lat?: double(name='Lat'),
      lon?: double(name='Lon'),
      province?: string(name='Province'),
    }(name='Geo'),
    idfa?: string(name='Idfa'),
    imei?: string(name='Imei'),
    imeimd5?: string(name='Imeimd5'),
    ip?: string(name='Ip'),
    language?: string(name='Language'),
    mac?: string(name='Mac'),
    macmd5?: string(name='Macmd5'),
    make?: string(name='Make'),
    model?: string(name='Model'),
    oaid?: string(name='Oaid'),
    os?: string(name='Os'),
    osv?: string(name='Osv'),
    ua?: string(name='Ua'),
    utdid?: string(name='Utdid'),
  }(name='Device'),
  ext?: map[string]any(name='Ext'),
  id?: string(name='Id'),
  imp?: [ 
    {
      id?: string(name='Id'),
      tagid?: string(name='Tagid'),
    }
  ](name='Imp'),
  test?: int32(name='Test'),
  user?: {
    uid?: string(name='Uid'),
    uidtype?: string(name='Uidtype'),
  }(name='User'),
}

model SearchAdvertisingShrinkRequest {
  appShrink?: string(name='App'),
  deviceShrink?: string(name='Device'),
  extShrink?: string(name='Ext'),
  id?: string(name='Id'),
  impShrink?: string(name='Imp'),
  test?: int32(name='Test'),
  userShrink?: string(name='User'),
}

model SearchAdvertisingResponseBody = {
  errorCode?: string(name='ErrorCode'),
  errorMsg?: string(name='ErrorMsg'),
  ext?: map[string]string(name='Ext'),
  header?: {
    costTime?: long(name='CostTime'),
    rpcId?: string(name='RpcId'),
    traceId?: string(name='TraceId'),
    version?: string(name='Version'),
  }(name='Header'),
  requestId?: string(name='RequestId'),
  result?: {
    bidid?: string(name='Bidid'),
    id?: string(name='Id'),
    seatbid?: [ 
      {
        bid?: [ 
          {
            ads?: [ 
              {
                brandid?: string(name='Brandid'),
                commission?: string(name='Commission'),
                crid?: string(name='Crid'),
                crurl?: string(name='Crurl'),
                id?: string(name='Id'),
                interacttype?: int32(name='Interacttype'),
                labeltype?: string(name='Labeltype'),
                landingurls?: [ string ](name='Landingurls'),
                marketingtype?: string(name='Marketingtype'),
                objective?: string(name='Objective'),
                style?: string(name='Style'),
                title?: string(name='Title'),
                trackers?: {
                  impressions?: [ string ](name='Impressions'),
                }(name='Trackers'),
                type?: string(name='Type'),
                icon?: {
                  url?: string(name='url'),
                }(name='icon'),
              }
            ](name='Ads'),
            impid?: string(name='Impid'),
          }
        ](name='Bid'),
      }
    ](name='Seatbid'),
  }(name='Result'),
  success?: boolean(name='Success'),
}

model SearchAdvertisingResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchAdvertisingResponseBody(name='body'),
}

async function searchAdvertisingWithOptions(tmpReq: SearchAdvertisingRequest, runtime: Util.RuntimeOptions): SearchAdvertisingResponse {
  Util.validateModel(tmpReq);
  var request = new SearchAdvertisingShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.app)) {
    request.appShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.app, 'App', 'json');
  }
  if (!Util.isUnset(tmpReq.device)) {
    request.deviceShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.device, 'Device', 'json');
  }
  if (!Util.isUnset(tmpReq.ext)) {
    request.extShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ext, 'Ext', 'json');
  }
  if (!Util.isUnset(tmpReq.imp)) {
    request.impShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imp, 'Imp', 'json');
  }
  if (!Util.isUnset(tmpReq.user)) {
    request.userShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.user, 'User', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appShrink)) {
    query['App'] = request.appShrink;
  }
  if (!Util.isUnset(request.deviceShrink)) {
    query['Device'] = request.deviceShrink;
  }
  if (!Util.isUnset(request.extShrink)) {
    query['Ext'] = request.extShrink;
  }
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.impShrink)) {
    query['Imp'] = request.impShrink;
  }
  if (!Util.isUnset(request.test)) {
    query['Test'] = request.test;
  }
  if (!Util.isUnset(request.userShrink)) {
    query['User'] = request.userShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchAdvertising',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchAdvertising(request: SearchAdvertisingRequest): SearchAdvertisingResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchAdvertisingWithOptions(request, runtime);
}

model SendTaokeInfoRequest {
  address?: string(name='Address'),
  age?: string(name='Age'),
  brandId?: string(name='BrandId'),
  channelId?: string(name='ChannelId'),
  city?: string(name='City'),
  componentId?: string(name='ComponentId'),
  district?: string(name='District'),
  environmentType?: string(name='EnvironmentType'),
  gender?: string(name='Gender'),
  imei?: string(name='Imei'),
  ip?: string(name='Ip'),
  mac?: string(name='Mac'),
  mediaId?: string(name='MediaId'),
  payPrice?: string(name='PayPrice'),
  phone?: string(name='Phone'),
  plat?: string(name='Plat'),
  productId?: string(name='ProductId'),
  productTitle?: string(name='ProductTitle'),
  province?: string(name='Province'),
  sellPrice?: string(name='SellPrice'),
  status?: string(name='Status'),
  userId?: string(name='UserId'),
  v?: string(name='V'),
}

model SendTaokeInfoResponseBody = {
  errorCode?: string(name='ErrorCode'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SendTaokeInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SendTaokeInfoResponseBody(name='body'),
}

async function sendTaokeInfoWithOptions(request: SendTaokeInfoRequest, runtime: Util.RuntimeOptions): SendTaokeInfoResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.address)) {
    body['Address'] = request.address;
  }
  if (!Util.isUnset(request.age)) {
    body['Age'] = request.age;
  }
  if (!Util.isUnset(request.brandId)) {
    body['BrandId'] = request.brandId;
  }
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.city)) {
    body['City'] = request.city;
  }
  if (!Util.isUnset(request.componentId)) {
    body['ComponentId'] = request.componentId;
  }
  if (!Util.isUnset(request.district)) {
    body['District'] = request.district;
  }
  if (!Util.isUnset(request.environmentType)) {
    body['EnvironmentType'] = request.environmentType;
  }
  if (!Util.isUnset(request.gender)) {
    body['Gender'] = request.gender;
  }
  if (!Util.isUnset(request.imei)) {
    body['Imei'] = request.imei;
  }
  if (!Util.isUnset(request.ip)) {
    body['Ip'] = request.ip;
  }
  if (!Util.isUnset(request.mac)) {
    body['Mac'] = request.mac;
  }
  if (!Util.isUnset(request.mediaId)) {
    body['MediaId'] = request.mediaId;
  }
  if (!Util.isUnset(request.payPrice)) {
    body['PayPrice'] = request.payPrice;
  }
  if (!Util.isUnset(request.phone)) {
    body['Phone'] = request.phone;
  }
  if (!Util.isUnset(request.plat)) {
    body['Plat'] = request.plat;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.productTitle)) {
    body['ProductTitle'] = request.productTitle;
  }
  if (!Util.isUnset(request.province)) {
    body['Province'] = request.province;
  }
  if (!Util.isUnset(request.sellPrice)) {
    body['SellPrice'] = request.sellPrice;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  if (!Util.isUnset(request.userId)) {
    body['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.v)) {
    body['V'] = request.v;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendTaokeInfo',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendTaokeInfo(request: SendTaokeInfoRequest): SendTaokeInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendTaokeInfoWithOptions(request, runtime);
}

model StartUnionTaskRequest {
  channelId?: string(name='ChannelId'),
  proxyUserId?: long(name='ProxyUserId'),
  taskId?: long(name='TaskId'),
}

model StartUnionTaskResponseBody = {
  code?: long(name='Code'),
  data?: boolean(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model StartUnionTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartUnionTaskResponseBody(name='body'),
}

async function startUnionTaskWithOptions(request: StartUnionTaskRequest, runtime: Util.RuntimeOptions): StartUnionTaskResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartUnionTask',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startUnionTask(request: StartUnionTaskRequest): StartUnionTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return startUnionTaskWithOptions(request, runtime);
}

model StopUnionTaskRequest {
  channelId?: string(name='ChannelId'),
  proxyUserId?: long(name='ProxyUserId'),
  taskId?: long(name='TaskId'),
}

model StopUnionTaskResponseBody = {
  code?: long(name='Code'),
  data?: boolean(name='Data'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model StopUnionTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StopUnionTaskResponseBody(name='body'),
}

async function stopUnionTaskWithOptions(request: StopUnionTaskRequest, runtime: Util.RuntimeOptions): StopUnionTaskResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopUnionTask',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function stopUnionTask(request: StopUnionTaskRequest): StopUnionTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopUnionTaskWithOptions(request, runtime);
}

model SyncUnionOrderRequest {
  age?: int32(name='Age'),
  applyPrice?: long(name='ApplyPrice'),
  bizSerialNumber?: string(name='BizSerialNumber'),
  brandName?: string(name='BrandName'),
  brandUserId?: long(name='BrandUserId'),
  channelId?: string(name='ChannelId'),
  deviceId?: string(name='DeviceId'),
  extendInfo?: string(name='ExtendInfo'),
  holderId?: string(name='HolderId'),
  industryLabelBagId?: int32(name='IndustryLabelBagId'),
  proxyChannelId?: string(name='ProxyChannelId'),
  proxyUserId?: long(name='ProxyUserId'),
  realCostAmount?: long(name='RealCostAmount'),
  sex?: string(name='Sex'),
  status?: string(name='Status'),
  taskBizType?: string(name='TaskBizType'),
  taskId?: long(name='TaskId'),
  taskRuleType?: string(name='TaskRuleType'),
  taskType?: string(name='TaskType'),
  tradeTimeString?: string(name='TradeTimeString'),
  v?: string(name='V'),
}

model SyncUnionOrderResponseBody = {
  aliPayOrderId?: string(name='AliPayOrderId'),
  errorCode?: string(name='ErrorCode'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
}

model SyncUnionOrderResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SyncUnionOrderResponseBody(name='body'),
}

async function syncUnionOrderWithOptions(request: SyncUnionOrderRequest, runtime: Util.RuntimeOptions): SyncUnionOrderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.age)) {
    query['Age'] = request.age;
  }
  if (!Util.isUnset(request.applyPrice)) {
    query['ApplyPrice'] = request.applyPrice;
  }
  if (!Util.isUnset(request.bizSerialNumber)) {
    query['BizSerialNumber'] = request.bizSerialNumber;
  }
  if (!Util.isUnset(request.brandName)) {
    query['BrandName'] = request.brandName;
  }
  if (!Util.isUnset(request.brandUserId)) {
    query['BrandUserId'] = request.brandUserId;
  }
  if (!Util.isUnset(request.channelId)) {
    query['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.deviceId)) {
    query['DeviceId'] = request.deviceId;
  }
  if (!Util.isUnset(request.extendInfo)) {
    query['ExtendInfo'] = request.extendInfo;
  }
  if (!Util.isUnset(request.holderId)) {
    query['HolderId'] = request.holderId;
  }
  if (!Util.isUnset(request.industryLabelBagId)) {
    query['IndustryLabelBagId'] = request.industryLabelBagId;
  }
  if (!Util.isUnset(request.proxyChannelId)) {
    query['ProxyChannelId'] = request.proxyChannelId;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.realCostAmount)) {
    query['RealCostAmount'] = request.realCostAmount;
  }
  if (!Util.isUnset(request.sex)) {
    query['Sex'] = request.sex;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.taskBizType)) {
    query['TaskBizType'] = request.taskBizType;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.taskRuleType)) {
    query['TaskRuleType'] = request.taskRuleType;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  if (!Util.isUnset(request.tradeTimeString)) {
    query['TradeTimeString'] = request.tradeTimeString;
  }
  if (!Util.isUnset(request.v)) {
    query['V'] = request.v;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SyncUnionOrder',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function syncUnionOrder(request: SyncUnionOrderRequest): SyncUnionOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return syncUnionOrderWithOptions(request, runtime);
}

model UpdateFlowRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  flow?: map[string]any(name='Flow'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model UpdateFlowShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  flowShrink?: string(name='Flow'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model UpdateFlowResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    applyUserId?: string(name='ApplyUserId'),
    approveTime?: long(name='ApproveTime'),
    approveUserId?: string(name='ApproveUserId'),
    businessKey?: string(name='BusinessKey'),
    childStatus?: string(name='ChildStatus'),
    extInfo?: string(name='ExtInfo'),
    flowId?: string(name='FlowId'),
    gmtCreateTime?: long(name='GmtCreateTime'),
    gmtModifiedTime?: long(name='GmtModifiedTime'),
    newData?: string(name='NewData'),
    oldData?: string(name='OldData'),
    reasonType?: string(name='ReasonType'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    type?: string(name='Type'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateFlowResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateFlowResponseBody(name='body'),
}

async function updateFlowWithOptions(tmpReq: UpdateFlowRequest, runtime: Util.RuntimeOptions): UpdateFlowResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateFlowShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.flow)) {
    request.flowShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.flow, 'Flow', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.flowShrink)) {
    body['Flow'] = request.flowShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateFlow',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateFlow(request: UpdateFlowRequest): UpdateFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateFlowWithOptions(request, runtime);
}

model UpdateUserRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  sspUser?: map[string]any(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model UpdateUserShrinkRequest {
  appName?: string(name='AppName'),
  business?: string(name='Business'),
  clientToken?: string(name='ClientToken'),
  environment?: string(name='Environment'),
  originSiteUserId?: string(name='OriginSiteUserId'),
  sspUserShrink?: string(name='SspUser'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
  userSite?: string(name='UserSite'),
}

model UpdateUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  model?: {
    email?: string(name='Email'),
    gmtCreateTime?: long(name='GmtCreateTime'),
    gmtModifiedTime?: long(name='GmtModifiedTime'),
    isDeleteTag?: string(name='IsDeleteTag'),
    mobilePhone?: string(name='MobilePhone'),
    roleCode?: string(name='RoleCode'),
    sspUserId?: string(name='SspUserId'),
    status?: string(name='Status'),
    tenantId?: string(name='TenantId'),
    tenantUserId?: string(name='TenantUserId'),
    userName?: string(name='UserName'),
    yunPersonsId?: string(name='YunPersonsId'),
    yunUid?: string(name='YunUid'),
  }(name='Model'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateUserResponseBody(name='body'),
}

async function updateUserWithOptions(tmpReq: UpdateUserRequest, runtime: Util.RuntimeOptions): UpdateUserResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateUserShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.sspUser)) {
    request.sspUserShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sspUser, 'SspUser', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.business)) {
    query['Business'] = request.business;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.environment)) {
    query['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.originSiteUserId)) {
    query['OriginSiteUserId'] = request.originSiteUserId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSite)) {
    query['UserSite'] = request.userSite;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.sspUserShrink)) {
    body['SspUser'] = request.sspUserShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateUser',
    version = '2018-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateUser(request: UpdateUserRequest): UpdateUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateUserWithOptions(request, runtime);
}

